Humidity sensor update

Python and python framework

Moderator: leecollings

Post Reply
User avatar
madpatrick
Posts: 667
Joined: Monday 26 December 2016 12:17
Target OS: Linux
Domoticz version: 2025.1
Location: Netherlands
Contact:

Humidity sensor update

Post 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
-= HP server GEN11 =- OZW -=- Toon2 (rooted) -=- Domoticz v2025.1 -=- Dashticz v3.14b on Tab8" =-
User avatar
waltervl
Posts: 5853
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Humidity sensor update

Post 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
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
User avatar
madpatrick
Posts: 667
Joined: Monday 26 December 2016 12:17
Target OS: Linux
Domoticz version: 2025.1
Location: Netherlands
Contact:

Re: Humidity sensor update

Post 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)
-= HP server GEN11 =- OZW -=- Toon2 (rooted) -=- Domoticz v2025.1 -=- Dashticz v3.14b on Tab8" =-
User avatar
waltervl
Posts: 5853
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Humidity sensor update

Post 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'
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
User avatar
madpatrick
Posts: 667
Joined: Monday 26 December 2016 12:17
Target OS: Linux
Domoticz version: 2025.1
Location: Netherlands
Contact:

Re: Humidity sensor update

Post 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.
-= HP server GEN11 =- OZW -=- Toon2 (rooted) -=- Domoticz v2025.1 -=- Dashticz v3.14b on Tab8" =-
User avatar
waltervl
Posts: 5853
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Humidity sensor update

Post 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?
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
User avatar
madpatrick
Posts: 667
Joined: Monday 26 December 2016 12:17
Target OS: Linux
Domoticz version: 2025.1
Location: Netherlands
Contact:

Re: Humidity sensor update

Post 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
-= HP server GEN11 =- OZW -=- Toon2 (rooted) -=- Domoticz v2025.1 -=- Dashticz v3.14b on Tab8" =-
User avatar
waltervl
Posts: 5853
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Humidity sensor update

Post by waltervl »

Great!
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
User avatar
madpatrick
Posts: 667
Joined: Monday 26 December 2016 12:17
Target OS: Linux
Domoticz version: 2025.1
Location: Netherlands
Contact:

Re: Humidity sensor update

Post 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
-= HP server GEN11 =- OZW -=- Toon2 (rooted) -=- Domoticz v2025.1 -=- Dashticz v3.14b on Tab8" =-
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest