External Temprature sensor

If you don't know where to post, post here.

Moderators: marcelr, TheHogNL, Toonz

RvE
Starting Member
Starting Member
Posts: 35
Joined: Fri May 01, 2020 3:07 pm

External Temprature sensor

Post by RvE »

Hi,

Is it possible to use an external temperature sensor with Toon(wired, z-wave or via a sensor added in Domoticz or Home Assistant)?
I don't want Toon in my livingroom as I use a tablet with Home Assistant.

I have a Rooted Toon V1

Greatings,

RvE
Toonz
Forum Moderator
Forum Moderator
Posts: 1873
Joined: Mon Dec 19, 2016 1:58 pm

Re: External Temprature sensor

Post by Toonz »

If you mean, show the temperature on a tile (getting the data via domotizs or HA) then yes.
If you mean using an external temperature sensor for use by the internal thermostat function to control your boiler, then no....
member of the Toon Software Collective
TheHogNL
Forum Moderator
Forum Moderator
Posts: 2125
Joined: Sun Aug 20, 2017 8:53 pm

Re: External Temprature sensor

Post by TheHogNL »

So this IS possible... just tested on a Toon1 (need to test on a Toon2 yet)

First, find a way to put (and update) your external temperature into a file on your toon (for example in /var/externaltemp). There are many ways to do this, please figure that out yourself.
The file should contain only one line, the temperature. I think it must be in this floating point format xx.yyyy so for example 28.345

Then edit /qmf/etc/qmf_release.xml and change useDynamicTempCorrection to 0 and create the line with sysFsTempAddress to point to a file which contains your external temperature.

Code: Select all

        <happ_thermstat>
                <useDynamicTempCorrection>0</useDynamicTempCorrection>
                <sysFsTempAddress>/var/externaltemp</sysFsTempAddress>
        </happ_thermstat>
Leave the other values the same.

And then reboot
Member of the Toon Software Collective
Toonz
Forum Moderator
Forum Moderator
Posts: 1873
Joined: Mon Dec 19, 2016 1:58 pm

Re: External Temprature sensor

Post by Toonz »

cool
member of the Toon Software Collective
RvE
Starting Member
Starting Member
Posts: 35
Joined: Fri May 01, 2020 3:07 pm

Re: External Temprature sensor

Post by RvE »

Thanx a lot.

I'm not very good at Linux and coding but I will find a way to 'upload' the temperature to Toon from my Home Assistant.

I think I need to make a file share or something to make the file available on the network and then write values to that file every 30 of 60 seconds.

Greetings,

RvE
marcelr
Global Moderator
Global Moderator
Posts: 1153
Joined: Thu May 10, 2012 10:58 pm
Location: Ehv

Re: External Temprature sensor

Post by marcelr »

Not sure about home assistant, but if you can post your data on a webserver, it's quite easy to transfer the data to your toon, using wget.
RvE
Starting Member
Starting Member
Posts: 35
Joined: Fri May 01, 2020 3:07 pm

Re: External Temprature sensor

Post by RvE »

I have a externat temperature sensor in Home Assistant.
Via Node_Red I've managed to write the temperature in a txt file.

I've installed apache2 webserver and used a symlink to the txt file.

On Toon I've created a simpel script that wil download the txt file via wget with a loop every 25 seconds.

I've edited the file /qmf/etc/qmf_release.xml

But no luck so far.

Here is the qmf_release.xml

Code: Select all

<happ_thermstat>                                                                                           
                <useDynamicTempCorrection>0</useDynamicTempCorrection>                                             
                <sysFsTempAddress>/var/externaltemp/temp.txt</sysFsTempAddress>                                    
        </happ_thermstat>     
The temperature in Toon is 18 with a correction of 12. So Toon displays a temperature of 30.

I will check the file permissions of /var/externaltemp/temp.txt.
I'm not shure if I can change the file permissions with wget.

Next step is to automaticly start the script at boot. I've tried moving the script to /etc/init.d but no luck so far.
RvE
Starting Member
Starting Member
Posts: 35
Joined: Fri May 01, 2020 3:07 pm

Re: External Temprature sensor

Post by RvE »

I've made one big Noob mistake....
I did not make a backup of the qmf_release.xml file :oops:

Is there a way to revert back to the original file?
(or reinstall everything)
RvE
Starting Member
Starting Member
Posts: 35
Joined: Fri May 01, 2020 3:07 pm

Re: External Temprature sensor

Post by RvE »

Ok... I'm almost done now :D :D :D

I found out that Toon is very slow updating the temperature.
So if I manually changed the temperature to 24.5, Toon will gradually change the temperature to 24.5. I think the whole process last a few minutes. So thats why I thought the scripts and settings did not work because I did not see any changes on the screen.

I found a bug in Toon. with this setup.
If I want to calibrate the temperature in the menu of Toon, it wil change to a very odd value and it is not possible to change that value..... So hands of of that setting :D

The Node Red script on Home Assistant works
The webserver works
The wget download script works
Toon reads the contents of the text file.

Only one thing that I need to solve is to automatically start the script at boot.

For the info:
Node Red see attached file.
Node Red
Node Red
Schermafbeelding 2020-08-15 om 23.37.11.png (172.94 KiB) Viewed 10531 times
download script (/etc/init.d/download_temp.sh):

Code: Select all

#!/bin/sh
while true
do
    wget -q -N -O /var/externaltemp/temp http://192.168.178.6/temp.txt
    sleep 30
done
and qmf_release.xml:

Code: Select all

        <happ_thermstat>                                                        
                <useDynamicTempCorrection>0</useDynamicTempCorrection>          
                <sysFsTempAddress>/var/externaltemp/temp</sysFsTempAddress>     
        </happ_thermstat>  
TheHogNL
Forum Moderator
Forum Moderator
Posts: 2125
Joined: Sun Aug 20, 2017 8:53 pm

Re: External Temprature sensor

Post by TheHogNL »

Check /etc/inittab
There is an example for the TSC script (/usr/bin/tsc) which you can use as example to alway start your script
Member of the Toon Software Collective
RvE
Starting Member
Starting Member
Posts: 35
Joined: Fri May 01, 2020 3:07 pm

Re: External Temprature sensor

Post by RvE »

TheHogNL wrote:Check /etc/inittab
There is an example for the TSC script (/usr/bin/tsc) which you can use as example to alway start your script
Not shure yet how I can use that but I will give it a try.

Last night I woke up because it was very hot in the house.
Turns out that the temperature reading in Toon was 0.0 so Toon was heating the whole house like crazy. And that during the warmest weeks of the year. :shock: :oops:

This morning I was checkin what was wrong.
I think that the wifi connection was lost somehow and the wget command did not work.
the temp file was empty. I don't know why the file should be empty if wget fails. It seems to me that the last successful reading should still be in the file.
I will try to reproduce the error.

I need to do something that if the reading is zero, it will automatically write a value of 60.0 to the file so Toon won't start heating the whole house.
If wget comes back again, the file will be overwritten by the right temperature.

Greetings,

RvE
RvE
Starting Member
Starting Member
Posts: 35
Joined: Fri May 01, 2020 3:07 pm

Re: External Temprature sensor

Post by RvE »

Sorry for the many post. I can not (yet) edit a post.
Fixed the 'bug'

Found out that wget did write an empty file upon error.
So I changed the script a litlle

Code: Select all

wget -N -O /var/externaltemp/download http://192.168.178.6/temp.txt && mv /var/externaltemp/download /var/externaltemp/temp
Wget downloads the file to the file dowload. If no error, mv moves that file to temp
If there is a error then mv wil not be launched.
RvE
Starting Member
Starting Member
Posts: 35
Joined: Fri May 01, 2020 3:07 pm

Re: External Temprature sensor

Post by RvE »

For your info and for others might want to do something similar:

Change the rights of the script with: chmod +x /etc/init.d/download_temp

Than add the following line to /etc/initttab:

Code: Select all

# HCBv2 static stuff
# #ovpn:235:respawn:/usr/sbin/openvpn --config /etc/openvpn/vpn.conf --verb 0 >/dev/null 2>&1
qtqt:245:respawn:/usr/bin/startqt >/dev/null 2>&1
tscs:245:respawn:/usr/bin/tsc >/var/log/tsc 2>&1
gett:235:respawn:/sbin/getty -L 115200 ttymxc0 vt102
temp:245:respawn:/etc/init.d/download_temp >/dev/null 2>&1
It all seems to work now. Rebooted Toon. rm the temp file, wait 30 seconds and check if the file is created. :D

(working on a Node red flow to check the sensor value and the value from Toon and if they don't match within 1 minute then notify.notify).

It's a huge step for me because I'm not that good in this :roll:

Thanx all for the help!

RvE
TheHogNL
Forum Moderator
Forum Moderator
Posts: 2125
Joined: Sun Aug 20, 2017 8:53 pm

Re: External Temprature sensor

Post by TheHogNL »

Nice work! This shows how much can be done with a bit of just trying and reading guides/manuals etc.

Unfortunatly this doesn't work on a Toon2 as it has other type of temp sensors which can not be changed to another file as in a Toon1 :(
Member of the Toon Software Collective
RvE
Starting Member
Starting Member
Posts: 35
Joined: Fri May 01, 2020 3:07 pm

Re: External Temprature sensor

Post by RvE »

TheHogNL wrote:Nice work! This shows how much can be done with a bit of just trying and reading guides/manuals etc.
The only thing is that if I change something, and that works, something else stops working.
Like now I don't have webacces anymore so Toon can't be controlled via Home Assistant :?

So back to the search function / google again.
Post Reply

Return to “Toon miscellaneous”