MadPatrick / domoticz_toon

Toon Control for Domoticz
GNU General Public License v2.0
7 stars 1 forks source link

Humidity sensor #7

Closed MadPatrick closed 1 year ago

MadPatrick commented 1 year ago

I'm trying to get the Humidity sensor working, but somehow it will no succeed

This is the definition in the plugin

    def onMessagetoonTSCinfo(self, Connection, Response):   
        Domoticz.Debug("onMessagetoonTSCinfo called")
        if 'humidity' in Response:
            humidity=float(Response['humidity'])
            strhumidity="%.1f" % humidity
            #UpdateDevice(Unit=RoomHumidity, nValue=0, sValue=strhumidity+";"+strtemperature)
            UpdateDevice(Unit=RoomHumidity, nValue=strhumidity, sValue=1)

But this is giving the following error

2023-01-21 10:32:28.194 Error: Toon: (CDevice_update) Toon - Luchtvochtigheid: Failed to parse parameters: 'nValue', 'sValue', 'Image', 'SignalLevel', 'BatteryLevel', 'Options', 'TimedOut', 'Name', 'TypeName', 'Type', 'Subtype', 'Switchtype', 'Used', 'Description', 'Color' or 'SuppressTriggers' expected.
2023-01-21 10:32:28.194 Error: Toon: Call to function 'CDevice_update' failed, exception details:
2023-01-21 10:32:28.194 Error: Toon: Exception: 'TypeError'. No traceback available.

When i change strhumidiy in a value, like 47 it is working

UpdateDevice(Unit=RoomHumidity, nValue=47, sValue=1)

image

JanJaapKo commented 1 year ago

Right, in which branch is this? Do you still need Beta branch? If so, did you rebase it onto latest main? Btw I personally favor the combined temp/hum devices. My Nest thermostat does the same and the plugin for Dyson I made, I also solved it like that.

MadPatrick commented 1 year ago

I've updated the Beta branch with my testing script I agree with you for the YTemp+HUm. But since it was not working i was using only HUM Now i finally got the value in the sensor we need to see how to get the realtime value

Also i need to find out where i can find the HUM_STAT value

MadPatrick commented 1 year ago

Found the HUM_STAT

This is the readout of the TSC Sensors:

// 20230121114252
// http://192.168.1.200/tsc/sensors

{
  "temperature": 19.0,
  "humidity": 44.4,
  "tvoc": 11,
  "eco2": 477,
  "intensity": 20
}

We need to use "intensity" and the adjust is

--hum_stat 0=Normal (niet gebruikt), 1=Comfortable, 2=Dry of 3=Wet zijn
--er wordt gekeken naar het dauwpunt, aangezien de luchtvochtigheid in combinatie met de temperatuur bepalend is voor hoe de luchtvochtigheid ervaren wordt
if intensity > 20 then
    hum_stat = 3 -- wet
elseif intensity> 10 and <20 then
    hum_stat = 1 -- confortable
else
    hum_stat = 2 -- dry
end
MadPatrick commented 1 year ago

Ok. Got it working Only Intensify needs to adjusted to

if intensity > 20 then
    hum_stat = 3 -- wet
elseif intensity> 10 and <20 then
    hum_stat = 1 -- confortable
else
    hum_stat = 2 -- dry
MadPatrick commented 1 year ago

I think it ok now, but please check if the programming is logical

Correction: Intensify value is the light intensity of the surrounding of the toon So i need to figure out something else