Jump to content

Introducing the Rainmachine Irrigation controller


glarsen

Recommended Posts

Introducing a Node Server for the Green Electronics Rainmachine Irrigation Controller. 

Release Notes

  • 0.5.0 08/04/2020
    • trap network error in restrictions update.
    • add error trapping to recover more gracefully from loss of contact with the Rainmachine
    • Restructure code to move node functions to separate files.
  • 0.4.0 03/04/2020
    • move rain sensor, freeze protect, rain delay to new 'Restrictions' node. Add info for active hourly, weekday, monthly restrictions
  • 0.3.0 014/02/2020
    • add delay between node adds during discovery
    • add some support for Master Zone - still needs some testing
  • 0.2.6 10/02/2020
    • initiate immediate node updates at start instead of waiting for first shortPoll
    • minor changes in initial loglevel setting code
    • added forecast today in precip node
  • 0.2.5 08/02/2020
    • update install.sh and add requests to requirements.txt
  • 0.2.4 06/02/2020
    • display loglevels as text instead of numbers
    • catch the case where the api call to rainsensorstate returns "None" in the event of a dropped connection to the Rainmachine
  • 0.2.3 06/02/2020
    • change json method for compatibility with earlier versions of Python requests.
  • 0.2.2 06/02/2020
    • change default error level to debug
  • 0.2.1 05/02/2020
    • clean up code a little.
  • 0.2.0 04/02/2020
    • added support for HW Vers 1. Tested only in simulation.
    • fixed apiver calls for HD12 & HD16
    • added code to strip some characters not supported by ISY from zone and program names. Convert '&' to 'and'.
    • added ability to set logging level from primary node.
  • 0.1.5 03/02/2020
    • added some error trapping to figure out HD12 apiver call response.
  • 0.1.4 02/02/2020
    • fixed logic error (I think) for next run day display.
  • 0.1.3 02/02/2020
    • added a check for hardware version to change https port numbers dependent on version.
    • added us units conversion for precip displays.
  • 0.1.2 30/01/2020
    • added rain delay setting in primary node.
  • 0.1.1 30/01/2020
    • Fix up some error handling.
  • 0.1.0 29/01/2020
    • Initial beta release.

This a beta version  initial release. so please provide feedback and let me know what you think.

I only have the Rainmachine Mini-8 so have only tested it on that.  The 12-HD and 16-HD use the same API, so I expect they would work also.

Installation is straightforward, simply install from the store, and add it to your polyglot. Then enter the IP or hostname of your Rainmachine, and the password used to login to it, in the configuration menu and restart.

It has been tested and runs on both the Polisy and the RPi.

Cheers!

Link to comment
Share on other sites

One of my irrigation program nodes showed in Polyglot, but not in ISY.  So there were 21 nodes in Polyglot, but only 20 in ISY.  I changed the name of the irrigation program (in RainMachine) from "Shrubs & Pots" to "Shrubs and Pots" and then did a re-discover.  This fixed the problem.  So just FYI, a "&" in the name appears to be problematic.  Thanks again for this.

Link to comment
Share on other sites

1 hour ago, carealtor said:

One of my irrigation program nodes showed in Polyglot, but not in ISY.  So there were 21 nodes in Polyglot, but only 20 in ISY.  I changed the name of the irrigation program (in RainMachine) from "Shrubs & Pots" to "Shrubs and Pots" and then did a re-discover.  This fixed the problem.  So just FYI, a "&" in the name appears to be problematic.  Thanks again for this.

Thanks for the feedback.  I'll sort that out.  Out for a long weekend now, so early next week.

Link to comment
Share on other sites

3 hours ago, glarsen said:

Introducing a Node Server for the Green Electronics Rainmachine Irrigation Controller. 

This a beta, version 0.1.2  initial release. so please provide feedback and let me know what you think.

I only have the Rainmachine Mini-8 so have only tested it on that.  The 12-HD and 16-HD use the same API, so I expect they would work also.

I take this means you don't expect it to work with the Gen1 RainMachine since the API does have some differences and the port number to access is different. 

Link to comment
Share on other sites

On 1/31/2020 at 1:40 PM, bpwwer said:

I take this means you don't expect it to work with the Gen1 RainMachine since the API does have some differences and the port number to access is different. 

Likely not, but it likely wouldn't be too hard to adapt to some of the differences.  Changing ports based on HWVer won't be hard, but unfortunately it doesn't seem as if the few calls I've used are all supported by hwVer 1.  Do you have a Gen1?

Edit: I've just pushed a minor change to modify the port number to 443 for hwVer=1,  and to use 8080 for other hardware.  If anyone can test it, that would be appreciated.  I haven't had time to check for other api differences, so if you find something not working, please let me know also.

Link to comment
Share on other sites

20 hours ago, glarsen said:

Likely not, but it likely wouldn't be too hard to adapt to some of the differences.  Changing ports based on HWVer won't be hard, but unfortunately it doesn't seem as if the few calls I've used are all supported by hwVer 1.  Do you have a Gen1?

Edit: I've just pushed a minor change to modify the port number to 443 for hwVer=1,  and to use 8080 for other hardware.  If anyone can test it, that would be appreciated.  I haven't had time to check for other api differences, so if you find something not working, please let me know also.

Yes, I have both so if I can find the time I'll try it out.  I think it's mostly the port number and then there are various API commands that aren't implemented on the Gen1 devices. I believe that for those that are implemented, they're mostly the same.

Link to comment
Share on other sites

Thanks Bob. It looks as if the things not supported in V1 are the freeze protect and rain sensor flags, and the mixer calls. That means no precip forecast info.  I should have an update out later today. Appreciate your feedback when you have time.

Link to comment
Share on other sites

10 minutes ago, glarsen said:

Appreciate your feedback when you have time.

Upgraded to version 0.1.4, and I'm getting this in the log:

020-02-03 11:33:16,157 [Interface ] [DEBUG] Received stop from Polyglot... Shutting Down.
2020-02-03 11:33:16,160 [Interface ] [INFO ] Disconnecting from MQTT... localhost:1883
2020-02-03 11:33:16,161 [Interface ] [DEBUG] Rainmachine NodeServer stopped.
2020-02-03 11:33:16,163 [Interface ] [INFO ] MQTT Graceful disconnection.
2020-02-03 11:33:20,259 [MainThread] [INFO ] Received Config from STDIN.
2020-02-03 11:33:20,261 [MainThread] [INFO ] UDI Polyglot v2 Interface 2.0.34 Starting...
2020-02-03 11:33:21,380 [MainThread] [DEBUG] gws: {'default': {2: ('192.168.1.1', 'igb0')}, 2: [('192.168.1.1', 'igb0', True)]}
2020-02-03 11:33:21,381 [MainThread] [DEBUG] gw: default=('192.168.1.1', 'igb0')
2020-02-03 11:33:21,382 [MainThread] [DEBUG] ifad: igb0=[{'addr': '192.168.1.19', 'netmask': '255.255.255.0', 'broadcast': '192.168.1.255'}]
2020-02-03 11:33:21,383 [MainThread] [INFO ] Connect: Network Interface: {'addr': '192.168.1.19', 'netmask': '255.255.255.0', 'broadcast': '192.168.1.255'}
2020-02-03 11:33:21,384 [Interface ] [INFO ] Connecting to MQTT... localhost:1883
2020-02-03 11:33:21,414 [Interface ] [INFO ] MQTT Connected with result code 0 (Success)
2020-02-03 11:33:21,415 [Interface ] [INFO ] MQTT Subscribing to topic: udi/polyglot/ns/11 -  MID: 1 Result: 0
2020-02-03 11:33:21,416 [Interface ] [INFO ] MQTT Subscribing to topic: udi/polyglot/connections/polyglot -  MID: 2 Result: 0
2020-02-03 11:33:21,417 [Interface ] [INFO ] Sent Connected message to Polyglot
2020-02-03 11:33:21,536 [NodeServer] [INFO ] Started Rainmachine NodeServer
2020-02-03 11:33:21,539 [NodeServer] [DEBUG] {'name': 'RainMachine', 'docs': 'https://github.com/VE7GEL/RainMachine', 'type': 'python3', 'executable': 'rainmachine.py', 'install': 'install.sh', 'install_cloud': 'install_cloud.sh', 'description': 'Rainmachine Node Server', 'notice': 'Only tested on Mini-8', 'shortPoll': '30', 'longPoll': '60', 'testMode': False, 'profile_version': '1.0.3', 'credits': [{'title': "RainMachine: a NodeServer for Green Electronics' Rainmachine Irrigation Controller", 'author': 'Gordon Larsen', 'version': '0.1.4', 'date': 'January 30, 2020', 'source': 'https://github.com/ve7gel/RainMachine', 'license': 'https://github.com/ve7gel/RainMachine/blob/master/LICENSE'}], 'version': '0.1.4', 'version_major': 0.1, 'version_minor': 4}
2020-02-03 11:33:21,596 [NodeServer] [INFO ] mk_profile: done.
2020-02-03 11:33:21,603 [NodeServer] [INFO ] profile_zip: profile/version.txt as version.txt
2020-02-03 11:33:21,608 [NodeServer] [INFO ] profile_zip: profile/nls/en_us.txt as nls/en_us.txt
2020-02-03 11:33:21,611 [NodeServer] [INFO ] profile_zip: profile/nodedef/nodedefs.xml as nodedef/nodedefs.xml
2020-02-03 11:33:21,613 [NodeServer] [INFO ] profile_zip: profile/editor/editors.xml as editor/editors.xml
2020-02-03 11:33:21,615 [NodeServer] [INFO ] Sending Install Profile command to Polyglot.
2020-02-03 11:33:21,617 [NodeServer] [INFO ] Check for existing configuration value
2020-02-03 11:33:21,617 [NodeServer] [INFO ] Adding configuration
2020-02-03 11:33:21,618 [NodeServer] [INFO ] Sending customParams to Polyglot.
2020-02-03 11:33:21,619 [NodeServer] [INFO ] remove all notices
2020-02-03 11:33:25,147 [NodeServer] [ERROR] Exception in thread NodeServer:
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/threading.py", line 926, in _bootstrap_inner
    self.run()
  File "/usr/local/lib/python3.7/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "./rainmachine.py", line 104, in start
    self.discover()
  File "./rainmachine.py", line 243, in discover
    rmdata=rm.getRainMachineVersion("http://"+self.host)
  File "/var/polyglot/nodeservers/RainMachine/rm_functions/rmfuncs.py", line 17, in getRainMachineVersion
    return json.loads(response.content)
  File "/usr/local/lib/python3.7/json/__init__.py", line 348, in loads
    return _default_decoder.decode(s)
  File "/usr/local/lib/python3.7/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/local/lib/python3.7/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

    

 

Link to comment
Share on other sites

7 minutes ago, Bumbershoot said:

Upgraded to version 0.1.4, and I'm getting this in the log:


020-02-03 11:33:16,157 [Interface ] [DEBUG] Received stop from Polyglot... Shutting Down.
2020-02-03 11:33:16,160 [Interface ] [INFO ] Disconnecting from MQTT... localhost:1883
2020-02-03 11:33:16,161 [Interface ] [DEBUG] Rainmachine NodeServer stopped.
2020-02-03 11:33:16,163 [Interface ] [INFO ] MQTT Graceful disconnection.
2020-02-03 11:33:20,259 [MainThread] [INFO ] Received Config from STDIN.
2020-02-03 11:33:20,261 [MainThread] [INFO ] UDI Polyglot v2 Interface 2.0.34 Starting...
2020-02-03 11:33:21,380 [MainThread] [DEBUG] gws: {'default': {2: ('192.168.1.1', 'igb0')}, 2: [('192.168.1.1', 'igb0', True)]}
2020-02-03 11:33:21,381 [MainThread] [DEBUG] gw: default=('192.168.1.1', 'igb0')
2020-02-03 11:33:21,382 [MainThread] [DEBUG] ifad: igb0=[{'addr': '192.168.1.19', 'netmask': '255.255.255.0', 'broadcast': '192.168.1.255'}]
2020-02-03 11:33:21,383 [MainThread] [INFO ] Connect: Network Interface: {'addr': '192.168.1.19', 'netmask': '255.255.255.0', 'broadcast': '192.168.1.255'}
2020-02-03 11:33:21,384 [Interface ] [INFO ] Connecting to MQTT... localhost:1883
2020-02-03 11:33:21,414 [Interface ] [INFO ] MQTT Connected with result code 0 (Success)
2020-02-03 11:33:21,415 [Interface ] [INFO ] MQTT Subscribing to topic: udi/polyglot/ns/11 -  MID: 1 Result: 0
2020-02-03 11:33:21,416 [Interface ] [INFO ] MQTT Subscribing to topic: udi/polyglot/connections/polyglot -  MID: 2 Result: 0
2020-02-03 11:33:21,417 [Interface ] [INFO ] Sent Connected message to Polyglot
2020-02-03 11:33:21,536 [NodeServer] [INFO ] Started Rainmachine NodeServer
2020-02-03 11:33:21,539 [NodeServer] [DEBUG] {'name': 'RainMachine', 'docs': 'https://github.com/VE7GEL/RainMachine', 'type': 'python3', 'executable': 'rainmachine.py', 'install': 'install.sh', 'install_cloud': 'install_cloud.sh', 'description': 'Rainmachine Node Server', 'notice': 'Only tested on Mini-8', 'shortPoll': '30', 'longPoll': '60', 'testMode': False, 'profile_version': '1.0.3', 'credits': [{'title': "RainMachine: a NodeServer for Green Electronics' Rainmachine Irrigation Controller", 'author': 'Gordon Larsen', 'version': '0.1.4', 'date': 'January 30, 2020', 'source': 'https://github.com/ve7gel/RainMachine', 'license': 'https://github.com/ve7gel/RainMachine/blob/master/LICENSE'}], 'version': '0.1.4', 'version_major': 0.1, 'version_minor': 4}
2020-02-03 11:33:21,596 [NodeServer] [INFO ] mk_profile: done.
2020-02-03 11:33:21,603 [NodeServer] [INFO ] profile_zip: profile/version.txt as version.txt
2020-02-03 11:33:21,608 [NodeServer] [INFO ] profile_zip: profile/nls/en_us.txt as nls/en_us.txt
2020-02-03 11:33:21,611 [NodeServer] [INFO ] profile_zip: profile/nodedef/nodedefs.xml as nodedef/nodedefs.xml
2020-02-03 11:33:21,613 [NodeServer] [INFO ] profile_zip: profile/editor/editors.xml as editor/editors.xml
2020-02-03 11:33:21,615 [NodeServer] [INFO ] Sending Install Profile command to Polyglot.
2020-02-03 11:33:21,617 [NodeServer] [INFO ] Check for existing configuration value
2020-02-03 11:33:21,617 [NodeServer] [INFO ] Adding configuration
2020-02-03 11:33:21,618 [NodeServer] [INFO ] Sending customParams to Polyglot.
2020-02-03 11:33:21,619 [NodeServer] [INFO ] remove all notices
2020-02-03 11:33:25,147 [NodeServer] [ERROR] Exception in thread NodeServer:
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/threading.py", line 926, in _bootstrap_inner
    self.run()
  File "/usr/local/lib/python3.7/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "./rainmachine.py", line 104, in start
    self.discover()
  File "./rainmachine.py", line 243, in discover
    rmdata=rm.getRainMachineVersion("http://"+self.host)
  File "/var/polyglot/nodeservers/RainMachine/rm_functions/rmfuncs.py", line 17, in getRainMachineVersion
    return json.loads(response.content)
  File "/usr/local/lib/python3.7/json/__init__.py", line 348, in loads
    return _default_decoder.decode(s)
  File "/usr/local/lib/python3.7/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/local/lib/python3.7/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

    

 

What RM Hardware are using, and I assume your polyglot is running on polisy?

 

Thanks. 

Link to comment
Share on other sites

Just now, Bumbershoot said:

It did run on the previous version, though my irrigation system is currently winterized, so I hadn't kicked the tires.

There must be something different than I expected returned for the apiver call.  I'll add some error trapping and post a new version in a bit.

Link to comment
Share on other sites

41 minutes ago, Bumbershoot said:

It did run on the previous version, though my irrigation system is currently winterized, so I hadn't kicked the tires.

The latest version added a call to determine what hardware we are running on. That's where the error occurred (even though it ran on my mini-8).  I made a minor change and added some exception trapping and debug statements to the next version. 0.1.5 is in the store now.  Please let me know what happens and we'll take it from there.  Thanks for your help.

Link to comment
Share on other sites

1 hour ago, glarsen said:

Please let me know what happens and we'll take it from there.

It appears that the nodeserver started normally in version 0.1.5, and it seems to be chugging along happily.  It might be up to six weeks before I charge my irrigation system, but I'll watch the nodeserver logs in the meantime.

Many thanks!

Link to comment
Share on other sites

Just now, Bumbershoot said:

It appears that the nodeserver started normally in version 0.1.5, and it seems to be chugging along happily.  It might be up to six weeks before I charge my irrigation system, but I'll watch the nodeserver logs in the meantime.

Many thanks!

Can you please send me the log from the startup to where the node adds begin?  Just want to see what messages were received.

Thanks

Link to comment
Share on other sites

I am receiving the following when starting the nodeserver for my Touch HD-12 with firmware version 4.0.1129:

2020-02-05 23:23:50,034 [NodeServer] [INFO ] Found Rainmachine on port 8080
2020-02-05 23:23:50,036 [NodeServer] [ERROR] Error getting Rainmachine version info
2020-02-05 23:23:50,038 [NodeServer] [WARNING] ./rainmachine.py:258: ResourceWarning: unclosed <ssl.SSLSocket fd=8, family=AddressFamily.AF_INET, type=SocketType.SOCK_STREAM, proto=6, laddr=('192.168.7.12', 59408), raddr=('192.168.7.15', 8080)>
2020-02-05 23:23:50,043 [NodeServer] [INFO ] Rainmachine Hardware version: 2, API Version: , Software level 
2020-02-05 23:23:50,269 [NodeServer] [ERROR] Incorrect hostname or password
2020-02-05 23:23:50,270 [NodeServer] [WARNING] ./rainmachine.py:275: ResourceWarning: unclosed <ssl.SSLSocket fd=8, family=AddressFamily.AF_INET, type=SocketType.SOCK_STREAM, proto=6, laddr=('192.168.7.12', 59410), raddr=('192.168.7.15', 8080)>

I know I have setup the correct password (the same one I use for both the cloud site and the local website). Is it possible that the password value in the configuration parameters can't contain special characters - specifically a "%"?

EDIT: Changed the password to remove the special characters and still getting "[ERROR] Incorrect hostname or password." 

Link to comment
Share on other sites

I suppose it's possible,  but it would have to be something not allowed by the Python library because I don't do any processing on the password or host name. There is another user with a HD12 who seems to have it running ok. Are you running 0.2.0 of the nodeserver?  He was using 0.1.5, so maybe I broke something during the latest changes.  Can you try a different password and see what happens?

 

Edit:  I just tried changing my password and using a % in it and it works ok, so I don't think that's it.

Link to comment
Share on other sites

14 minutes ago, glarsen said:

Are you running 0.2.0 of the nodeserver?  ... Can you try a different password and see what happens?

I am running 0.2.0 of the nodeserver. I did change the password to have just alphanumeric characters, and I am getting the same error message.

Here's what my unit returns for apiVer endpoint: {"apiVer": "4.6.1", "hwVer": 3, "swVer": "4.0.1129"}

Link to comment
Share on other sites

What hardware are you running on?  I've just pushed v 0.2.1 with an extra debug statement in the API version get call.  If you could turn debug on and send me the log again I'd appreciate it.

 

The thing is, the call to get the version info doesn't use authentication, so there is something else going on.  Have you installed your own certificate?  I wonder if there is something related to that, since verify is disabled in the code.

Link to comment
Share on other sites

RPi and debug is on. Don't see any debug messages in log, however. But they are there for all my other nodeservers. Here is the log entries with the new version of rmfuncs.py (looks the same):

2020-02-06 00:15:00,965 [NodeServer] [INFO ] Found Rainmachine on port 8080
2020-02-06 00:15:00,966 [NodeServer] [ERROR] Error getting Rainmachine version info
2020-02-06 00:15:00,968 [NodeServer] [WARNING] ./rainmachine.py:258: ResourceWarning: unclosed <ssl.SSLSocket fd=8, family=AddressFamily.AF_INET, type=SocketType.SOCK_STREAM, proto=6, laddr=('192.168.7.12', 33522), raddr=('192.168.7.15', 8080)>
2020-02-06 00:15:00,972 [NodeServer] [INFO ] Rainmachine Hardware version: 2, API Version: , Software level 
2020-02-06 00:15:01,178 [NodeServer] [ERROR] Incorrect hostname or password
2020-02-06 00:15:01,180 [NodeServer] [WARNING] ./rainmachine.py:275: ResourceWarning: unclosed <ssl.SSLSocket fd=8, family=AddressFamily.AF_INET, type=SocketType.SOCK_STREAM, proto=6, laddr=('192.168.7.12', 33524), raddr=('192.168.7.15', 8080)>

 

Link to comment
Share on other sites

That suggests the call is failing and the code never gets to  the debug statement. Can you try https://ip.of.hd.12:8080/api/4/apiVer in a browser and tell me what you get please?

Edit: I also changed the default errorlevel to debug.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.


×
×
  • Create New...