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.
 
 

339 lines
13 KiB

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