Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Multiple Master stations (pump sources) possible?
#11
Oh, cool! Thanks for the /jp link!

I think node-red can make an http request any time and I'll see about parsing the JSON in there.
I should be able to do some parsing in node-red to make sense of the program data, once I learn how.

Since the simplest way for node-red to retrieve the program data is an HTTP request to SIP, it probably makes sense for SIP to make an HTTP connection to node-red when the program changes are submitted in SIP. This will be the trigger for node-red to request the new /jp doc.

The other option is to make a similar plugin to the get_values MQTT, which sends the new program JSON to node-red when there's an update.
I'm leaning to this MQTT option since I have plugins to copy. I'm not sure if adding a CURL HTTP request to the code is as elegant.

A couple small things to let you know:
- Line 77 of mqtt_get_values.py kills the plugin function, I think there's a deprecated gv property in there. Commenting it out, it works fine.
- I don't think the SIP restart is working for me. When I do certain things like update active plugins, the system says it's restarting, but I have to do my own kill and restart before the menu updates, for example. Python 2.7 on Raspbian in a VirtualBox VM.
Reply
#12
Thanks for the heads-up on the problem in the mqtt_get_values plugin. The gv.sd[u"wl_weather"] value is only available if the weather_level_adj plugin is installed. I left line 77 in but commented out and updated SIP's plugin repo on GitHub.

As far as parsing SIP's program data this may help:

Program data with example values:

key['enabled'] = 1 # Bool, Use 1 or 0 to avod difference between Py True and JS true
key['type'] = 'alldays' | 'evendays' | 'odddays' | 'interval'
key['day_mask'] = 127 # days of week 0 to 7, or if type == interval - interval days
key['interval_base_day'] = 4 # based on dse (days since epoc)
key['start_min'] = 360 # 6AM
key['stop_min'] = 1080 # 6PM
key['cycle_min'] = 240 # 4 hours
key['duration_sec'] = [0]*gv.sd['nst'] # List of duration times of len # stations
key['station_mask'] = [0]*gv.sd['nbrd'] # List of 1 byte per board
key['name'] = 'un-named' # program name


The day_mask and station_mask values are bit masks. The "name" value has not been implemented in SIP yet.

Dan
<p><br></p>
Reply
#13
Great, thanks! This will help a lot with parsing.
I really appreciate your responsiveness, and your app is really great work all around.
I will keep you posted with my progress, and post a dedicated thread when I have something to show.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)