RainEagle library plus script for polling data
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

365 lines
13 KiB

  1. Help on module EagleClass:
  2. NAME
  3. EagleClass
  4. FILE
  5. RainEagle/EagleClass.py
  6. CLASSES
  7. __builtin__.object
  8. Eagle
  9. exceptions.RuntimeError(exceptions.StandardError)
  10. RainEagleResponseError
  11. class Eagle(__builtin__.object)
  12. | Class for talking to Rainforest Automation EAGLE (RFA-Z109)
  13. |
  14. | args:
  15. | debug print debug messages if true
  16. | addr address of device
  17. | port port on device (default 5002)
  18. | getmac connect to device at start up and get macid (default true)
  19. |
  20. | Currently there is very little error handling ( if any at all )
  21. |
  22. | Methods defined here:
  23. |
  24. | __init__(self, **kwargs)
  25. |
  26. | cloud_reset(self)
  27. | cloud_reset : Clear Cloud Configuration
  28. |
  29. | confirm_message(self, id)
  30. |
  31. | factory_reset(self)
  32. | Factory Reset
  33. |
  34. | get_demand_values(self, macid=None, interval='hour', frequency=None)
  35. | Send the GET_DEMAND_VALUES command
  36. | get a series of instantaneous demand values
  37. |
  38. | args:
  39. | MacId 16 hex digits, MAC addr of EAGLE ZigBee radio
  40. | Interval hour | day | week
  41. | [Frequency] int seconds between samples
  42. |
  43. | get_device_config(self)
  44. | get remote management status
  45. |
  46. | On Success returns dict with value 'Y' or 'N' :
  47. | 'config_ssh_enabled': 'Y'
  48. | 'config_vpn_enabled': 'Y'
  49. |
  50. | get_device_data(self, macid=None)
  51. | Send the GET_DEVICE_DATA command to get a data dump
  52. |
  53. | get_fast_poll_status(self, macid=None)
  54. | Send the GET_FAST_POLL_STATUS command
  55. | get the current status of fast poll mode.
  56. |
  57. | args:
  58. | MacId 16 hex digits, MAC addr of EAGLE ZigBee radio
  59. |
  60. | get_gateway_info(self)
  61. | gets network status
  62. |
  63. | On Success returns dict with the values (example):
  64. | 'gateway_cloud_id': '00:09:69'
  65. | 'gateway_internet_status': 'connected'
  66. | 'gateway_ip_addr': '10.11.12.13'
  67. | 'gateway_mac_id': 'D8:D5:B9:00:90:24'
  68. |
  69. | get_historical_data_alt(self, period='day')
  70. | get a series of summation values over an interval of time
  71. | ( http command api )
  72. |
  73. | args:
  74. | period day|week|month|year
  75. |
  76. | On Success returns dict with the values (example):
  77. | 'data_period' 'day',
  78. | 'data_size' '14',
  79. | 'timestamp[0]' '1394422200',
  80. | 'timestamp[1]' '1394425800',
  81. | 'timestamp[2]' '1394429400',
  82. | 'timestamp[3]' '1394433000',
  83. | 'timestamp[4]' '1394436600',
  84. | 'timestamp[5]' '1394440200',
  85. | 'timestamp[6]' '1394443800',
  86. | 'timestamp[7]' '1394447400',
  87. | 'timestamp[8]' '1394451000',
  88. | 'timestamp[9]' '1394454600',
  89. | 'timestamp[10]' '1394458200',
  90. | 'timestamp[11]' '1394461800',
  91. | 'timestamp[12]' '1394465400',
  92. | 'timestamp[13]' '1394469000',
  93. | 'value[0]' '0.429',
  94. | 'value[1]' '0.426',
  95. | 'value[2]' '0.422',
  96. | 'value[3]' '0.627',
  97. | 'value[4]' '0.735',
  98. | 'value[5]' '0.193',
  99. | 'value[6]' '0.026',
  100. | 'value[7]' '-0.985',
  101. | 'value[8]' '-1.491',
  102. | 'value[9]' '-2.196'}
  103. | 'value[11]' '-1.868',
  104. | 'value[12]' '-1.330',
  105. | 'value[13]' '-0.870',
  106. |
  107. | get_history_data(self, macid=None, starttime='0x00000000', endtime=None, frequency=None)
  108. | Send the GET_HISTORY_DATA command
  109. | get a series of summation values over an interval of time
  110. | ( socket command api )
  111. |
  112. | args:
  113. | MacId 16 hex digits, MAC addr of EAGLE ZigBee radio
  114. | StartTime the start of the history interval (default oldest sample)
  115. | EndTime the end of the history interval (default current time)
  116. | Frequency Requested number of seconds between samples.
  117. |
  118. | get_instantaneous_demand(self, macid=None)
  119. | Send the GET_INSTANTANEOUS_DEMAND command
  120. | get the real time demand from the meter
  121. |
  122. | args:
  123. | MacId 16 hex digits, MAC addr of EAGLE ZigBee radio
  124. |
  125. | get_message(self)
  126. | On Success returns dict with the values (example):
  127. | "meter_status" : "Connected"
  128. | "message_timestamp" : "946684800"
  129. | "message_text" : ""
  130. | "message_confirmed" : "N"
  131. | "message_confirm_required" : "N"
  132. | "message_id" : "0"
  133. | "message_queue" : "active"
  134. | "message_priority" : ""
  135. | "message_read" : "Y"
  136. |
  137. | get_price(self)
  138. | get price for kWh
  139. |
  140. | On Success returns (example):
  141. | price': '0.1300',
  142. | price_label': 'Set by User' or '--'
  143. | price_timestamp': '1394524458',
  144. | price_units': '$'}
  145. |
  146. | returns empty dict on Error
  147. |
  148. | get_remote_management(self)
  149. |
  150. | get_setting_data(self)
  151. | get settings data
  152. |
  153. | returns empty dict on Error
  154. |
  155. | get_summation_values(self, macid=None, interval='day')
  156. | Send the GET_SUMMATION_VALUES command
  157. | get a series of net summation values
  158. |
  159. | args:
  160. | MacId 16 hex digits, MAC addr of EAGLE ZigBee radio
  161. | Interval day | week | month | year
  162. |
  163. | get_time_source(self, macid=None)
  164. | get time source for device
  165. |
  166. | On Success returns dict with value 'internet' or 'meter' :
  167. | 'time_source': 'internet'}
  168. |
  169. | get_timezone(self)
  170. | get current timezone configuration
  171. |
  172. | On Success returns dict with the value :
  173. | 'timezone_localTime': '1394527011'
  174. | 'timezone_olsonName': 'UTC/GMT',
  175. | 'timezone_status': '2'
  176. | 'timezone_utcOffset': 'UTC'
  177. | 'timezone_utcTime': '1394527011'
  178. | 'timezone_status': 'success'
  179. |
  180. | get_uploader()
  181. | gets current uploaders config
  182. |
  183. | On Success returns dict with the values (example):
  184. | "uploader_timestamp" : "1394503703"
  185. | "uploader_provider" : "bidgely"
  186. | "uploader_protocol" : "https"
  187. | "uploader_hostname" : "api.bidgely.com"
  188. | "uploader_url" : "/v1/users/44441b47-1b9a-4a65-8e8c-0efefe05bb88/homes/1/gateways/1"
  189. | "uploader_port" : "0"
  190. | "uploader_auth_code" : "44441b47-1b9a-4a65-8e8c-0efefe05bb88"
  191. | "uploader_email" : ""
  192. | "uploader_user_id" : ""
  193. | "uploader_password" : ""
  194. | "uploader_enabled" : "Y"
  195. |
  196. | See also set_cloud() to set current uploader cloud config
  197. |
  198. | get_uploaders(self)
  199. | gets list of uploaders for Web UI
  200. |
  201. | On Success returns dict with the values (example):
  202. | 'uploader[0]': 'none'
  203. | 'uploader[1]': 'bidgely'
  204. | 'uploader_name[0]': 'None'
  205. | 'uploader_name[1]': 'Bidgely Inc.'
  206. |
  207. | get_usage_data(self)
  208. |
  209. | list_devices(self)
  210. |
  211. | set_cloud(self, url, authcode='', email='')
  212. | set cloud Url
  213. |
  214. | args:
  215. | url Url for uploader
  216. | authcode
  217. | email
  218. |
  219. | See also get_uploader() to retrieve current uploader cloud config
  220. |
  221. | set_fast_poll(self, macid=None, frequency='0x04', duration='0xFF')
  222. | Send the SET_FAST_POLL command
  223. | set the fast poll mode on the meter
  224. |
  225. | args:
  226. | MacId 16 hex digits, MAC addr of EAGLE ZigBee radio
  227. | Frequency 0x01 - 0xFF Freq to poll meter, in seconds
  228. | Duration 0x00 - 0x0F Duration of fast poll mode, in minutes (max 15)
  229. |
  230. | set_message_read(self)
  231. | On Success returns dict with the values :
  232. | 'remote_management_status' : 'success'
  233. |
  234. | set_price(self, price)
  235. | Set price manualy
  236. |
  237. | args:
  238. | price Price/kWh
  239. |
  240. | On Success returns dict with value :
  241. | 'set_price_status': 'success'
  242. |
  243. | set_price_auto(self)
  244. | Set Price from Meter
  245. |
  246. | On Success returns dict with value :
  247. | 'set_price_status': 'success'
  248. |
  249. | set_remote_management(self, macid=None, status='on')
  250. | set_remote_management
  251. | enabling ssh & vpn
  252. |
  253. | args:
  254. | status on|off
  255. |
  256. | On Success returns dict with value :
  257. | 'remote_management_status': 'success'
  258. |
  259. | set_time_source(self, macid=None, source=None)
  260. | set_time_source
  261. | set time source
  262. |
  263. | args:
  264. | source meter|internet
  265. |
  266. | On Success returns dict with value :
  267. | 'set_time_source_status': u'success'
  268. |
  269. | On Error returns dict with value :
  270. | 'set_time_source_status': 'invalid source name'
  271. |
  272. | ----------------------------------------------------------------------
  273. | Data descriptors defined here:
  274. |
  275. | __dict__
  276. | dictionary for instance variables (if defined)
  277. |
  278. | __weakref__
  279. | list of weak references to the object (if defined)
  280. class RainEagleResponseError(exceptions.RuntimeError)
  281. | General exception for responce errors
  282. | from Rainforest Automation EAGLE (RFA-Z109)
  283. |
  284. | Method resolution order:
  285. | RainEagleResponseError
  286. | exceptions.RuntimeError
  287. | exceptions.StandardError
  288. | exceptions.Exception
  289. | exceptions.BaseException
  290. | __builtin__.object
  291. |
  292. | Data descriptors defined here:
  293. |
  294. | __weakref__
  295. | list of weak references to the object (if defined)
  296. |
  297. | ----------------------------------------------------------------------
  298. | Methods inherited from exceptions.RuntimeError:
  299. |
  300. | __init__(...)
  301. | x.__init__(...) initializes x; see help(type(x)) for signature
  302. |
  303. | ----------------------------------------------------------------------
  304. | Data and other attributes inherited from exceptions.RuntimeError:
  305. |
  306. | __new__ = <built-in method __new__ of type object>
  307. | T.__new__(S, ...) -> a new object with type S, a subtype of T
  308. |
  309. | ----------------------------------------------------------------------
  310. | Methods inherited from exceptions.BaseException:
  311. |
  312. | __delattr__(...)
  313. | x.__delattr__('name') <==> del x.name
  314. |
  315. | __getattribute__(...)
  316. | x.__getattribute__('name') <==> x.name
  317. |
  318. | __getitem__(...)
  319. | x.__getitem__(y) <==> x[y]
  320. |
  321. | __getslice__(...)
  322. | x.__getslice__(i, j) <==> x[i:j]
  323. |
  324. | Use of negative indices is not supported.
  325. |
  326. | __reduce__(...)
  327. |
  328. | __repr__(...)
  329. | x.__repr__() <==> repr(x)
  330. |
  331. | __setattr__(...)
  332. | x.__setattr__('name', value) <==> x.name = value
  333. |
  334. | __setstate__(...)
  335. |
  336. | __str__(...)
  337. | x.__str__() <==> str(x)
  338. |
  339. | __unicode__(...)
  340. |
  341. | ----------------------------------------------------------------------
  342. | Data descriptors inherited from exceptions.BaseException:
  343. |
  344. | __dict__
  345. |
  346. | args
  347. |
  348. | message
  349. DATA
  350. __all__ = ['Eagle', 'RainEagleResponseError', 'to_epoch_1970, to_epoch...
  351. __author__ = 'Peter Shipley <peter.shipley@gmail.com>'
  352. __copyright__ = 'Copyright (C) 2014 Peter Shipley'
  353. __license__ = 'BSD'
  354. AUTHOR
  355. Peter Shipley <peter.shipley@gmail.com>