Domoticz BurnerInfo script activate light switch

Everything about external control, apps, VNC, etc goes here.

Moderators: marcelr, TheHogNL, TerrorSource, Toonz

Domoticz BurnerInfo script activate light switch

Postby Duiken60 » Thu Nov 14, 2019 8:26 pm

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.
Duiken60
Starting Member
Starting Member
 
Posts: 9
Joined: April 2019

Re: Domoticz BurnerInfo script activate light switch

Postby TheHogNL » Thu Nov 14, 2019 9:35 pm

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'?
Member of the Toon Software Collective
User avatar
TheHogNL
Forum Moderator
Forum Moderator
 
Posts: 1301
Joined: August 2017

Re: Domoticz BurnerInfo script activate light switch

Postby Duiken60 » Sun Nov 17, 2019 7:38 pm

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.
Duiken60
Starting Member
Starting Member
 
Posts: 9
Joined: April 2019

Re: Domoticz BurnerInfo script activate light switch

Postby TheHogNL » Sun Nov 17, 2019 9:00 pm

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.
Member of the Toon Software Collective
User avatar
TheHogNL
Forum Moderator
Forum Moderator
 
Posts: 1301
Joined: August 2017

Re: Domoticz BurnerInfo script activate light switch

Postby Duiken60 » Sun Nov 17, 2019 9:28 pm

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
Duiken60
Starting Member
Starting Member
 
Posts: 9
Joined: April 2019

Re: Domoticz BurnerInfo script activate light switch

Postby TheHogNL » Sun Nov 17, 2019 11:04 pm

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.
Member of the Toon Software Collective
User avatar
TheHogNL
Forum Moderator
Forum Moderator
 
Posts: 1301
Joined: August 2017

Re: Domoticz BurnerInfo script activate light switch

Postby Duiken60 » Sun Nov 17, 2019 11:09 pm

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.
Duiken60
Starting Member
Starting Member
 
Posts: 9
Joined: April 2019

Re: Domoticz BurnerInfo script activate light switch

Postby TheHogNL » Mon Nov 18, 2019 8:53 am

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.
Member of the Toon Software Collective
User avatar
TheHogNL
Forum Moderator
Forum Moderator
 
Posts: 1301
Joined: August 2017

Re: Domoticz BurnerInfo script activate light switch

Postby Duiken60 » Mon Nov 18, 2019 1:21 pm

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.
Duiken60
Starting Member
Starting Member
 
Posts: 9
Joined: April 2019

Re: Domoticz BurnerInfo script activate light switch

Postby TheHogNL » Mon Nov 18, 2019 1:44 pm

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.
Member of the Toon Software Collective
User avatar
TheHogNL
Forum Moderator
Forum Moderator
 
Posts: 1301
Joined: August 2017

Re: Domoticz BurnerInfo script activate light switch

Postby Duiken60 » Mon Nov 18, 2019 3:37 pm

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?
Duiken60
Starting Member
Starting Member
 
Posts: 9
Joined: April 2019

Re: Domoticz BurnerInfo script activate light switch

Postby TheHogNL » Mon Nov 18, 2019 3:58 pm

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.
Member of the Toon Software Collective
User avatar
TheHogNL
Forum Moderator
Forum Moderator
 
Posts: 1301
Joined: August 2017

Re: Domoticz BurnerInfo script activate light switch

Postby Duiken60 » Mon Nov 18, 2019 5:34 pm

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.
Duiken60
Starting Member
Starting Member
 
Posts: 9
Joined: April 2019

Re: Domoticz BurnerInfo script activate light switch

Postby TheHogNL » Mon Nov 18, 2019 7:02 pm

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?
Member of the Toon Software Collective
User avatar
TheHogNL
Forum Moderator
Forum Moderator
 
Posts: 1301
Joined: August 2017

Re: Domoticz BurnerInfo script activate light switch

Postby Duiken60 » Mon Nov 18, 2019 7:37 pm

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.

:)
Duiken60
Starting Member
Starting Member
 
Posts: 9
Joined: April 2019


Return to Toon external control

Who is online

Users browsing this forum: No registered users and 1 guest