Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Using rf control plugin along with relay board
#1
So I have my setup working great with the relay board plugin.  I had read in another thread about potentially using the rf control plugin to run basic http or API commands to control other stations.  I have it set up now where I have a few 'outlying' stations that are hooked up to ESP8266's for running their relays.  So far I just run/schedule these via cron on my raspberry pi and that has worked well but it would be nice to be able to also have those show up and be controlled via SIP.  I had installed the rf_control plugin and it looks fairly straightforward to modify it to use http commands to turn the valves on/off but will it be able to work alongside the relay board plugin?  And if so how would I modify the config to do that?  Any ideas would be appreciated.  Thanks.
Reply
#2
Both plugins should be able run run at the same time.
You should only need to add the commands to control your remote stations. Once the rf plugin is installed it will generate a file in the SIP/data directory named "rf_control.json". You can edit that file to add your commands.

Try it and let us know how it goes. If there needs to be any changes to either the SIP code or the plugin code I will work with you to get things working and update the code on GitHub.

Dan
Reply
#3
Hey Dan,
Thanks again for the prompt response.  I guess where I got confused on this part is how to structure that json file to work properly.  The default file has a bunch of lines for on/off of stations 1-8.  I have the relay board working for 1-12 already so the rf_control would then start on 13.  So the command I would want to run is "wget http://xxx.xxx.xxx.xxx/relay1on"...would I have to add more 'dummy' commands for 1-12 in there and then this one would be the 13th for station 13 or would it be like "on command for station 13: wget http://xxx.xxx.xxx.xxx/relay1on"?
Reply
#4
As the description of the plugin says it has been in a testing (beta) stage. It was written for a user who was setting up some stations that he wanted to control wirelessly. He had 2 types of commands he could send to the remote stations and the plugin code was set up to handle both but not at the same time.

I have been planning to split the plugin into 2 separate plugins. One for HTTP commands and the other for cli commands. There is some code in the current version that is commented out and needs to be activated in order to use HTTP commands.

The way it works is:
SIP issues a signal when a station is turned on or off. Plugins can "subscribe" to the signal and when the signal is received a function is triggered. The rf_control plugin runs a function called "on_zone_change()" which figures out which station changed and outputs the corresponding command to control the remote station. The commands are stored in a Python list and are accessed by their position in the list (index).

So, to answer your question, you will need to keep dummy commands in the list for the stations controlled by the relay_board plugin.

However I think there will also need to be some changes to the plugin in order to skip the stations controlled by the relay_board plugin. It would be good to have a defined place-holder in the command list that would be skipped by the plugin when that station is controlled some other way. Looking at the code it doesn't look like it has everything it needs to send GET commands.

Let me work on this. It should be fairly easy (famous last words). I'll try to put something together within the next day tor two.

Dan
Reply
#5
It took longer that I expected but a replacement for the rf_control plugin is now available. It is called cli_control.

Once it is installed you can go to Plugins>cli_control and enter commands on the plugin's UI page rather than having to edit the cli_control.json file.

Dan
Reply
#6
(2017 Jul 22, 09:10 PM)dan Wrote: It took longer that I expected but a replacement for the rf_control plugin is now available. It is called cli_control.

Once it is installed you can go to Plugins>cli_control and enter commands on the plugin's UI page rather than having to edit the cli_control.json file.

Dan

Hi Dan   
 i'm looking at using this  for fixed grid on farms  we have a base  with 100=300 Node link to it    so we send out   the timeframe the valves to turn on and off each day and the Node keep in hourly or set time for until updates for any changes

we looking at using a loRa unit  with a simple H-bridge  so we just need to get the package send form the Pi  to a base radio  so the Nodes  can recive it 

can this be done   if so any help be great  to pass onto  a IT guy  who i get to custom it for me   or if you know anyone 

cheers
steve dawson 
ag -innovators
Reply
#7
Hi Steve,

The SIP plugin "cli_control" (which has replaced the rf_control plugin) is designed to send Linux commands such as "wget http://xxx.xxx.xxx.xxx/relay1on" so if the LoRa unit can be reached via a standard IP connection you can send commands to it.

There is also the possibility to use MQTT by installing the corresponding plugins.

I suggest you have your IT guy take a look at those plugins. They are pretty straight forward.

Dan
Reply
#8
Hey Dan,
Very much appreciate the work you did for this plugin, this does exactly what I needed.  I have been using it for a few days now and it has worked perfectly.  Thanks again.
Reply
#9
(2017 Jul 26, 05:52 PM)ruffledrooster Wrote: Hey Dan,
Very much appreciate the work you did for this plugin, this does exactly what I needed.  I have been using it for a few days now and it has worked perfectly.  Thanks again.

Hi ruffledrooster,
Can you please post some pics of how you have implemented this LoRa setup, am trying to have a similar LoRa setup with multiple nodes (each irrigation node has; valve control, line water pressure sensor, 3 soil moisture sensors) I need to control each node based on soil moisture in each area. Also one node dedicated to master valve/pump (master node measures main line pressure, 3 phase voltage, current, water level in the tank).
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)