Author Topic: Rainforest Automation Eagle ZigBee Smart Meter HAN Gateway Plugin  (Read 34283 times)

Offline ssenneff

  • Newbie
  • *
  • Posts: 13
  • Karma: +0/-0
Re: Rainforest Automation Eagle ZigBee Smart Meter HAN Gateway Plugin
« Reply #105 on: November 11, 2017, 10:47:52 am »
Will this work with the newer Eagle-200?  Amazon no longer sells the Eagle.

Offline jswim788

  • Hero Member
  • *****
  • Posts: 798
  • Karma: +58/-2
Re: Rainforest Automation Eagle ZigBee Smart Meter HAN Gateway Plugin
« Reply #106 on: November 11, 2017, 04:38:23 pm »
I suspect it will work with the Eagle-200, but I have no way to test.  You could email and ask if the API is the same or similar.  They know that many people use the existing API's and would like to use code that is already out there.  Hopefully they took that into consideration.

Offline ssenneff

  • Newbie
  • *
  • Posts: 13
  • Karma: +0/-0
Re: Rainforest Automation Eagle ZigBee Smart Meter HAN Gateway Plugin
« Reply #107 on: November 13, 2017, 05:34:44 pm »
I installed the plugin, but its not working.  I get this message in the log "SmartMeterHAN1 : HAN device not found. Verify connection and IP address." and the status message on the device says "Lua Startup Failure".  I'm sure the ip address is correct.  Here is the API info from their website which has it for the Eagle-200: https://rainforestautomation.com/support/developer/

Offline jswim788

  • Hero Member
  • *****
  • Posts: 798
  • Karma: +58/-2
Re: Rainforest Automation Eagle ZigBee Smart Meter HAN Gateway Plugin
« Reply #108 on: November 13, 2017, 06:02:17 pm »
You are trying the files in the original post?  If so, it may be that the XML response at port 5002 is now disabled.  Try the files I have attached at this post instead: http://forum.micasaverde.com/index.php/topic,14767.msg325432.html#msg325432

I do recommend that you pick up the later implementation file from this post as well: http://forum.micasaverde.com/index.php/topic,14767.msg325466.html#msg325466

The latter makes it easier to install.  Upload the files, restart Vera, set the IP and MAC address (and the cloud ID and Device IN if you have security turned on) and restart again.  This uses port 80 - I think that has a better chance of working for the newer model.

Offline ssenneff

  • Newbie
  • *
  • Posts: 13
  • Karma: +0/-0
Re: Rainforest Automation Eagle ZigBee Smart Meter HAN Gateway Plugin
« Reply #109 on: November 14, 2017, 04:15:33 am »
I used the files you recommended.  I also ended up deleting and recreating the device. I no longer get the same error of the device not found or startup error, but do see a comm failure and of course not data.  Here are some of the log entries that look relevant:

 01   11/14/17 2:56:52.882   Device_LuaUPnP::CreateService can't parse xml /etc/cmh-ludl//S_SmartMeterHAN1.xml for 118/Eagle200 <0x2b29f000>
01   11/14/17 2:56:52.883   Device_LuaUPnP::CreateServices removing incomplete service from 118 <0x2b29f000>
03   11/14/17 2:57:01.893   luup_log:118: Starting ZigBee HAN device, version 0.41js __LEAK__ this:192512 start:458752 to 0xde8000 <0x2bbd3680>
02   11/14/17 2:57:02.100   ZWaveJobHandler::SetDeviceStatus XXX2 0/0/0/0 __LEAK__ this:77824 start:536576 to 0xdfb000 <0x2b9d3680>
01   11/14/17 2:57:02.248   luup_require can't find dkjson <0x2bbd3680>
06   11/14/17 2:57:02.309   Device_Variable::m_szValue_set device: 118 service: urn:micasaverde-com:serviceId:HaDevice1 variable: CommFailure was: 1 now: 1 #hooks: 0 upnp: 0 v:0xa82490/NONE duplicate:1 <0x2bbd3680>
03   11/14/17 2:57:02.310   luup_log:118: Starting ZigBee HAN device, version 0.41js <0x2bbd3680>
02   11/14/17 2:57:02.312   luup_require duplicate dkjson <0x2bbd3680>
06   11/14/17 2:57:02.358   Device_Variable::m_szValue_set device: 118 service: urn:micasaverde-com:serviceId:HaDevice1 variable: CommFailure was: 1 now: 1 #hooks: 0 upnp: 0 v:0xa82490/NONE duplicate:1 <0x2bbd3680>

Offline jswim788

  • Hero Member
  • *****
  • Posts: 798
  • Karma: +58/-2
Re: Rainforest Automation Eagle ZigBee Smart Meter HAN Gateway Plugin
« Reply #110 on: November 14, 2017, 09:47:29 am »
Let's start with the 2 issues:

1) you are missing dkjson.  You can download it from here http://dkolf.de/src/dkjson-lua.fsl/home and upload it to your Vera.

2) something is wrong with S_SmartMeterHAN1.xml - did it get uploaded correctly to your Vera or corrupted somehow?  Try uploading again.

After fixing both of the above, try a reboot.

Offline ssenneff

  • Newbie
  • *
  • Posts: 13
  • Karma: +0/-0
Re: Rainforest Automation Eagle ZigBee Smart Meter HAN Gateway Plugin
« Reply #111 on: November 18, 2017, 06:28:46 am »
I uploaded the dkjson file and reuploaded S_SmartMeterHAN1.xml and those errors are gone from the logs.  I still see the comm failure however:

03   11/18/17 5:05:01.554   luup_log:118: Starting ZigBee HAN device, version 0.41js <0x2bcdf680>
01   11/18/17 5:05:01.846   luup_require can't find lpeg <0x2bcdf680>
06   11/18/17 5:05:01.883   Device_Variable::m_szValue_set device: 118 service: urn:micasaverde-com:serviceId:HaDevice1 variable: CommFailure was: 1 now: 1 #hooks: 0 upnp: 0 v:0x8826c8/NONE duplicate:1 <0x2bcdf680>

I am getting output to the rainforest cloud.

Offline jswim788

  • Hero Member
  • *****
  • Posts: 798
  • Karma: +58/-2
Re: Rainforest Automation Eagle ZigBee Smart Meter HAN Gateway Plugin
« Reply #112 on: November 18, 2017, 10:53:40 am »
2 suggestions:

1) go back to this post (http://forum.micasaverde.com/index.php/topic,14767.msg325432.html#msg325432) and download the implementation file that I just uploaded.  I fixed the logging so we should be better able to see what is going wrong.  Upload the file and reload and take a look at the log.

2) type this into your browser (replace the IP with your Eagle's IP): http://192.168.1.201/cgi-bin/cgi_manager   Does it ask for authentication?  If so, type in the CloudId and DeviceIN you put into the plugin.  In either case, what do you see if you do this?  Something like "{}" would be normal.  Maybe you have an error message?

Offline ssenneff

  • Newbie
  • *
  • Posts: 13
  • Karma: +0/-0
Re: Rainforest Automation Eagle ZigBee Smart Meter HAN Gateway Plugin
« Reply #113 on: November 18, 2017, 01:49:18 pm »
I did both those things.  Following item#2, I was prompted to authenticate then got "404 - Not Found".  I don't know what interfaces the original Eagle has, but when going to the host on port 80 with the Eagle 200, the only thing you can do is set up the wifi.  No other configuration settings are available.

I restarted Vera and the Eagle 200 for good measure.  Here are the logs with the new implementation file:
09   11/18/17 12:40:15.534   JobHandler_LuaUPnP::Run device 118 Eagle200 room 0 type urn:schemas-smartmeter-han:device:SmartMeterHAN1:1 id  parent 0/0xcf6148 upnp: 0 <0x2ab21000>
03   11/18/17 12:40:19.126   luup_log:118: Starting ZigBee HAN device, version 0.41js <0x2b455680>
06   11/18/17 12:40:19.355   Device_Variable::m_szValue_set device: 118 service: urn:micasaverde-com:serviceId:HaDevice1 variable: CommFailure was: 1 now: 1 #hooks: 0 upnp: 0 v:0xd0e860/NONE duplicate:1 <0x2b455680>
03   11/18/17 12:40:19.356   luup_log:118: Starting ZigBee HAN device, version 0.41js <0x2b455680>
02   11/18/17 12:40:19.358   luup_require duplicate dkjson <0x2b455680>
06   11/18/17 12:40:19.365   Device_Variable::m_szValue_set device: 118 service: urn:micasaverde-com:serviceId:HaDevice1 variable: CommFailure was: 1 now: 1 #hooks: 0 upnp: 0 v:0xd0e860/NONE duplicate:1 <0x2b455680>

Offline jswim788

  • Hero Member
  • *****
  • Posts: 798
  • Karma: +58/-2
Re: Rainforest Automation Eagle ZigBee Smart Meter HAN Gateway Plugin
« Reply #114 on: November 18, 2017, 02:27:31 pm »
Hmm, pretty sure you didn't get the latest I uploaded because it should have said 0.44js.  But that's irrelevant if you can't get anything on port 80.  There's no local access?  On mine I can get to the interface that you can see in the snippet I attached (just the IP address, no cgi added to it in the URL).  If you can get there, use Chrome and hit F12 to see what it is doing.  I looked at the network tab and can see the cgi-bin/cgi_manager calls.  I have to believe that there is something similar in the 200.  Take a look and see what you find.

Offline ssenneff

  • Newbie
  • *
  • Posts: 13
  • Karma: +0/-0
Re: Rainforest Automation Eagle ZigBee Smart Meter HAN Gateway Plugin
« Reply #115 on: November 18, 2017, 02:55:59 pm »
I don't have a device home page that looks like yours.  Actually there is discussion elsewhere like Amazon reviews about the lack of a local interface for the Eagle 200.  I think they released it before everything was built.  It doesn't work with the EnergyVUE mobile app either, but they are supposed to come out with a new app in Q1 2018.  I attached an image of my home screen.

You were correct on the implementation file.  I did something wrong.  Fixed and here is the output:
09   11/18/17 13:41:13.974   JobHandler_LuaUPnP::Run device 118 Eagle200 room 0 type urn:schemas-smartmeter-han:device:SmartMeterHAN1:1 id  parent 0/0xc99070 upnp: 0 <0x2ab36000>
03   11/18/17 13:41:16.617   luup_log:118: Starting ZigBee HAN device, version 0.44js <0x2b269680>
01   11/18/17 13:41:16.937   luup_require can't find lpeg <0x2b269680>
01   11/18/17 13:41:16.949   luup_log:118: Error connecting to Rainforest Eagle server port: 404 <0x2b269680>
06   11/18/17 13:41:16.950   Device_Variable::m_szValue_set device: 118 service: urn:micasaverde-com:serviceId:HaDevice1 variable: CommFailure was: 1 now: 1 #hooks: 0 upnp: 0 v:0xcb17b0/NONE duplicate:1 <0x2b269680>

Offline jswim788

  • Hero Member
  • *****
  • Posts: 798
  • Karma: +58/-2
Re: Rainforest Automation Eagle ZigBee Smart Meter HAN Gateway Plugin
« Reply #116 on: November 18, 2017, 04:13:19 pm »
I suppose that the plugin could try to fetch the data from the Rainforest servers.  Kind of goofy since it has the data locally, sends it out, then the plugin pulls it back from the cloud.  I'd have to think about that a bit.  There is an API for it, but it's definitely more complicated than the local access.

According the developer guide for the 200 it appears that there is a post manager.  Can you try accessing this (with your correct IP)?  http://192.168.1.201/cgi-bin/post_manager

You may not get anything back, but you are hoping to see no error.  If that works, then I think it is possible to access the data locally.  Unfortunately it appears to only support XML, not JSON, so I'd have to make a hybrid of the original code that parses XML.  If you are familiar with curl you can try doing some post requests and see if you can get responses.  In any case, see what you get with the URL above.

Offline ssenneff

  • Newbie
  • *
  • Posts: 13
  • Karma: +0/-0
Re: Rainforest Automation Eagle ZigBee Smart Meter HAN Gateway Plugin
« Reply #117 on: November 18, 2017, 05:02:56 pm »
Doing http://192.168.3.210/cgi-bin/post_manager gives a blank page - no error.  I don't know curl, but can learn.  Are there a few curl post requests I should try?

Offline jswim788

  • Hero Member
  • *****
  • Posts: 798
  • Karma: +58/-2
Re: Rainforest Automation Eagle ZigBee Smart Meter HAN Gateway Plugin
« Reply #118 on: November 18, 2017, 06:16:40 pm »
You would want to try something like this with curl:

curl --trace trace -X POST -i -H "Content-Type: text/xml" -u 'user:password' --data-binary '<Command><Name>wifi_status</Name></Command>' http://192.168.1.201/cgi-bin/post_manager

--trace trace puts the log information into the file named trace, -X POST makes it a post request, -H sets the content type, -i includes the HTTP response headers in the output

You need to figure out the user name and password.  The developer guide says the user name is the Cloud ID, and the password is the "EAGLE install code".  Not sure what that is, but maybe you do?

--data-binary gives the command we want, and it ends with the http URL - change the IP.  Also note that this is all one line.

This would be easier with direct access, but you'll likely need to fiddle with this a bit to get it to work.  Look into the 'trace' file each time you try to get some debug information.  If it does work, you should see some XML come back that indicates the WiFi status.  If you get that far, there is a good chance to make it work.

The next step would be to try this as the command instead of the one above: '<Command><Name>device_list</Name></Command>'
« Last Edit: November 18, 2017, 07:00:29 pm by jswim788 »

Offline ssenneff

  • Newbie
  • *
  • Posts: 13
  • Karma: +0/-0
Re: Rainforest Automation Eagle ZigBee Smart Meter HAN Gateway Plugin
« Reply #119 on: November 19, 2017, 11:38:07 am »
The CloudID and Install Code are both printed on the sticker that comes with the Eagle 200 device.  I used those with the curl commands you sent and it all works perfectly. It also is in the log file, but here was the XML on screen:

HTTP/1.1 200 OK
Access-Control-Allow-Origin: http://homebase.rainforestautomation.com:8080
Access-Control-Allow-Headers: Authorization, Content-Type, Accept
Access-Control-Allow-Methods: GET, POST
Access-Control-Allow-Credentials: true
Access-Control-Max-Age: 86400
Content-type: text/html
Transfer-Encoding: chunked
Date: Sun, 19 Nov 2017 16:31:08 GMT
Server: lighttpd/1.4.32

<DeviceList>
  <Device>
    <HardwareAddress>0x00078100006a18d7</HardwareAddress>
    <Manufacturer>Generic</Manufacturer>
    <ModelId>electric_meter</ModelId>
    <Protocol>Zigbee</Protocol>
    <LastContact>0x5a11b1cb</LastContact>
    <ConnectionStatus>Connected</ConnectionStatus>
    <NetworkAddress>0x0000</NetworkAddress>
  </Device>
</DeviceList>