Page 1 of 1

Humidity sensor update

Posted: Monday 09 January 2023 16:48
by madpatrick
Hi,

I want to update a humidity device with python
Every sensor of the script is working execpt the Humidity sensor

This is the part of the script

Code: Select all

            Domoticz.Device(Name="Luchtvochtigheid", Unit=RoomHumidity, Type=81, Subtype=1, Used=1).Create()

Code: Select all

    def onMessagetoonTSCinfo(self, Connection, Response):	
        Domoticz.Debug("onMessagetoonTSCinfo called")	
        if 'humidity' in Response:	
            humidity=float(Response['humidity'])	
            strhumidity="%.1f" % humidity
            temperature=float(Response['temperature'])	
            strtemperature="%.1f" % temperature
            UpdateDevice(Unit=RoomHumidity, nValue=0, sValue=strtemperature+";"+strhumidity)
Ik krijg de info, maar er gebeurd niets

Code: Select all

2023-01-09 16:39:08.910 Toon: Device: 14 - ID: 637, Name: 'Toon - Luchtvochtigheid', nValue: 0, sValue: '18.8;58.0'
2023-01-09 16:40:08.187 Toon: Update 0:'18.8;58.1' (Toon - Luchtvochtigheid)
2023-01-09 16:47:37.221 Toon: Update 0:'18.7;58.2' (Toon - Luchtvochtigheid)
2023-01-09 16:47:57.224 Toon: Update 0:'18.7;58.3' (Toon - Luchtvochtigheid)
2023-01-09 16:48:17.203 Toon: Update 0:'18.7;58.2' (Toon - Luchtvochtigheid)
I've added now the temparature because i know it uses also the temp/humidity to give a message about he climate
I've using device type=81, but also device type=82 (temp+hum) is not working
The information is read, but no info in the device

Re: Humidity sensor update

Posted: Monday 09 January 2023 17:18
by waltervl
Did you follow the values as given in the API doc https://www.domoticz.com/wiki/Domoticz_API/JSON_URL%27s ?
Humidity needs 2 values: nvalue=HUM&svalue=HUM_STAT
Temp +Hum needs 3 values: nvalue=0&svalue=TEMP;HUM;HUM_STAT

Re: Humidity sensor update

Posted: Monday 09 January 2023 17:37
by madpatrick
waltervl wrote: Monday 09 January 2023 17:18 Did you follow the values as given in the API doc https://www.domoticz.com/wiki/Domoticz_API/JSON_URL%27s ?
Humidity needs 2 values: nvalue=HUM&svalue=HUM_STAT
Temp +Hum needs 3 values: nvalue=0&svalue=TEMP;HUM;HUM_STAT
Yes.
The device is getting to values

Code: Select all

2023-01-09 17:34:38.224 Toon: Update 0:'55.0;0' (Toon - Luchtvochtigheid)
2023-01-09 17:34:58.197 Toon: Update 0:'54.5;0' (Toon - Luchtvochtigheid)
2023-01-09 17:35:18.203 Toon: Update 0:'54.9;0' (Toon - Luchtvochtigheid)

Re: Humidity sensor update

Posted: Monday 09 January 2023 19:17
by waltervl
When I see line below svalue is incorrect

Code: Select all

2023-01-09 16:39:08.910 Toon: Device: 14 - ID: 637, Name: 'Toon - Luchtvochtigheid', nValue: 0, sValue: '18.8;58.0'

Re: Humidity sensor update

Posted: Monday 09 January 2023 19:21
by madpatrick
waltervl wrote: Monday 09 January 2023 19:17 When I see line below svalue is incorrect

Code: Select all

2023-01-09 16:39:08.910 Toon: Device: 14 - ID: 637, Name: 'Toon - Luchtvochtigheid', nValue: 0, sValue: '18.8;58.0'
That is correct.
This was an old value

I tired it with 2 values and tried it with temperature.
Now changed to correct value as you can see
Return value is 0.

Re: Humidity sensor update

Posted: Monday 09 January 2023 19:24
by waltervl
I must say my python plugin programming knowledge stops here.... Perhaps look at another plugin that has these kind of devices.

Perhaps Domoticz or the new DomoticzEx framework device update mixup?

Re: Humidity sensor update

Posted: Saturday 21 January 2023 12:57
by madpatrick
Waltervl

I have solved the issue

Code: Select all

            UpdateDevice(Unit=RoomHumidity, nValue=0, sValue=strtemperature+";"+strhumidity+";"+strintensity)
The problem was the HUM_STAT. (strintensity)
Found a solution to generate a proper value 0,1,2 or 3

Re: Humidity sensor update

Posted: Saturday 21 January 2023 13:06
by waltervl
Great!

Re: Humidity sensor update

Posted: Saturday 21 January 2023 13:09
by madpatrick
Only just found out that my intrepation of the HUM_STAT of completly wrong :D
is is the value of the lightsensor :lol: :lol:

But the device is giving the HUM + TEMP
Only HUM_STAT needs some more work