Page 1 of 1

Domoticz BurnerInfo script activate light switch

PostPosted: Thu Nov 14, 2019 8:26 pm
by Duiken60
I have the Rooted Tooon already in use for a few months and connected to my Domoticz, The Toon Script works good. Now I try to use the Burnerinfo selector switch as a source for activating a light switch in my Domoticz.
It is this part of the script
Code: Select all
   if currentBurnerInfo == 0 then currentBurnerInfo = '0' -- uit
         elseif currentBurnerInfo == 1 then currentBurnerInfo = '10' -- cv aan
         elseif currentBurnerInfo == 2 then currentBurnerInfo = '20' -- warmwater aan
         end

Can somebody help me to activate an ON/OFF switch called SW1 and turn it on as soon as the BurnerInfo switch '10' and if state is '0' turn OFF the switch again.


Pls help me, Struggling with it already 2.5 weeks to get it working.

Re: Domoticz BurnerInfo script activate light switch

PostPosted: Thu Nov 14, 2019 9:35 pm
by TheHogNL
Should not be that hard. At the lines just after that, these ones:
Code: Select all
if CurrentToonBurnerValue ~= currentBurnerInfo then  -- Update toon burner selector if it has changed
print ('Updating Toon burner info')
commandArray[7] = {['UpdateDevice'] = string.format('%s|1|%s', otherdevices_idx[ToonBurnerName], currentBurnerInfo)}
end


you could flip that light switch. Just need to find out the right command to flip a domoticz switch. Google is your friend.

However, what is your ultimate goal? Are you maybe trying to do this: https://www.domoticaforum.eu/viewtopic.php?f=97&t=12568 where I turn on a smartplug on a electric heater when the burnerinfo is '1'?

Re: Domoticz BurnerInfo script activate light switch

PostPosted: Sun Nov 17, 2019 7:38 pm
by Duiken60
Because I do not understand the script, I cannot addapt it to Domoticz. That is why I asked the same question on the Domoticz forum.
I only want to control an dummy on/off switch in Domoticz.
BR.

Re: Domoticz BurnerInfo script activate light switch

PostPosted: Sun Nov 17, 2019 9:00 pm
by TheHogNL
Duiken60 wrote:Because I do not understand the script, I cannot addapt it to Domoticz. That is why I asked the same question on the Domoticz forum.
I only want to control an dummy on/off switch in Domoticz.
BR.


But I am asking you want your goal is? I think it is not only to switch a dummy on/off switch. Probably that switch is linked to something else?
So what do you want to do? Having domoticz between it is maybe not a good idea depening on your goal.

Re: Domoticz BurnerInfo script activate light switch

PostPosted: Sun Nov 17, 2019 9:28 pm
by Duiken60
My goal is to switch an solar driven set of fans (low rpm) mounted on my heating devices. These fans are turned on/of during the heating period (Burner info. Hope I made it clear my goal.
Hope you can help me.

BR. Dick

Re: Domoticz BurnerInfo script activate light switch

PostPosted: Sun Nov 17, 2019 11:04 pm
by TheHogNL
Duiken60 wrote:My goal is to switch an solar driven set of fans (low rpm) mounted on my heating devices. These fans are turned on/of during the heating period (Burner info. Hope I made it clear my goal.
Hope you can help me.


Ok you could use that other script I posted about switching on or off an eletric heater directly from the Toon. Depends a bit how you want to switch the fans on or off. Already know how you where planning to switch them from domoticz? If it is a simple HTTP request it can be easily done from the Toon bypassing the domoticz server.

Re: Domoticz BurnerInfo script activate light switch

PostPosted: Sun Nov 17, 2019 11:09 pm
by Duiken60
From the Toon Bypassing?? I do not understand what you mean. It will be an HTTP command and I tried already to the 'level action' of the 'BranderInfo' . This is the way I trigger an HTTP command but that does not work for the 'Branderinfo' button.

Re: Domoticz BurnerInfo script activate light switch

PostPosted: Mon Nov 18, 2019 8:53 am
by TheHogNL
Duiken60 wrote:From the Toon Bypassing?? I do not understand what you mean. It will be an HTTP command and I tried already to the 'level action' of the 'BranderInfo' . This is the way I trigger an HTTP command but that does not work for the 'Branderinfo' button.


I mean, when you run the script (in https://www.domoticaforum.eu/viewtopic.php?f=97&t=12568) on the Toon, the routine doesn't depend on domoticz to run or not.

Just place that script somewhere in the Toon. Change the curl request in the script to a HTTP request of your fan controller. If you run in manually it will run forever but ofcourse won't start at boot. To start on boot you need install it at the right place.

If you give me the http command you use for your fan controller I will change the script for you and paste it here and tell you how to run it.

Re: Domoticz BurnerInfo script activate light switch

PostPosted: Mon Nov 18, 2019 1:21 pm
by Duiken60
I appreciate it. Here are my HTTP command, one for
ON http://192.168.1.138/control?cmd=GPIO,12,1 and
OFF http://192.168.1.138/control?cmd=GPIO,12,0

Hope to hear from you.

Re: Domoticz BurnerInfo script activate light switch

PostPosted: Mon Nov 18, 2019 1:44 pm
by TheHogNL
Duiken60 wrote:I appreciate it. Here are my HTTP command, one for
ON http://192.168.1.138/control?cmd=GPIO,12,1 and
OFF http://192.168.1.138/control?cmd=GPIO,12,0

Hope to hear from you.


Ok this script should work.

Code: Select all
#!/bin/sh
STATE=-1
while true
do
  NEWSTATE=`curl -Nks http://localhost/happ_thermstat?action=getThermostatInfo | sed 's/.*"burnerInfo":"\([0-9]\)".*/\1/'`
  if [ $NEWSTATE -eq 2 ]
  then
    # burning for hot water, do not start fans
    NEWSTATE=0
  fi
  if [ $NEWSTATE -eq 3 ]
  then
    # toon is in preheating state, turn on fans also
    NEWSTATE=1
  fi   
  if [ "$STATE" -ne "$NEWSTATE" ]
  then
    STATE=$NEWSTATE
    RESULT=`curl -Nks "http://192.168.1.138/control?cmd=GPIO,12,$STATE"`
  fi
  sleep 10
done


Place it in your toon (for example as filename /usr/bin/fancontroller). Then change the file on the toon to be executable (chmod +x /usr/bin/fancontroller).
You then can run the script manually (just type /usr/bin/fancontroller) to see if it works as intended.

If you are happy, then place this line in /etc/inittab (just after where the line starts with qtqt)
Code: Select all
fanc:245:respawn:/usr/bin/fancontroller >/dev/null 2>&1
and then restart your toon or type 'init q' to get the script started.

Re: Domoticz BurnerInfo script activate light switch

PostPosted: Mon Nov 18, 2019 3:37 pm
by Duiken60
I am a total beginner in Linux so I connected to the Toon device and loged on. Checked the rights and got this back
drwxr-xr-x 2 root root 16336 Nov 1 11:03 /usr/bin
How can I get the script on my Toon. Sorry but I realy dont know. Lot of info using Google but afrait of bricking my Toon.
Suggestions?
Advice?

Re: Domoticz BurnerInfo script activate light switch

PostPosted: Mon Nov 18, 2019 3:58 pm
by TheHogNL
Use a linux text editor to create that file (I advice joe for you, just google for the 'joe editor for linux manual' or something). You can also use joe to edit the /etc/inittab file
Linux commandline is not that different from a dos prompt. Some specific commands you need to learn.

If you are not able to learn to work on linux than this method is maybe not the best choice for you I am afraid.

Re: Domoticz BurnerInfo script activate light switch

PostPosted: Mon Nov 18, 2019 5:34 pm
by Duiken60
I used the Joe editor on my Pi. Now it is on my Toon and it works perfectly. Thanks for the advise and the solution.
Br.

Re: Domoticz BurnerInfo script activate light switch

PostPosted: Mon Nov 18, 2019 7:02 pm
by TheHogNL
Duiken60 wrote:I used the Joe editor on my Pi. Now it is on my Toon and it works perfectly. Thanks for the advise and the solution.
Br.


Ok nice! Care to share some results of the fans? For example, does it help to get your room faster on the right temperature? And can you share your details about the solar fans?

Re: Domoticz BurnerInfo script activate light switch

PostPosted: Mon Nov 18, 2019 7:37 pm
by Duiken60
After testing I share my results related to reduction of heating costs and add extra info how my solar panel act as a power supply for my Fans.

:)