Page 1 of 1

Events from Xiaiomi devices

Posted: Friday 28 February 2020 9:00
by ulfh2018
I have just started trying a Xiomi Gateway, and the only device I have been testing so far is a temperature / humidity sensor. This seems to work, though it looks like the reading are sometimes missing for shorter or longer periods.

I want to be able to send information using MQTT, which means I have to get information from for example:
IDX Hardware ID Unit Name Type Sub Type Value
10 Xiaomi AD55 85 Temperatur Ute Temp LaCrosse TX3 16.9 C
9 Dummy 0014059 1 Termostat Ute Thermostat SetPoint 16.5

The second entry is for a thermostat setting, and I pick up information using dzVents like this;

Code: Select all

return {
    on = {       timer = { 'every minute'  } },
  
    execute = function(domoticz)
        local Sensor    = domoticz.devices(10)  -- Temperature
        local SETPOINT  = domoticz.devices(9) -- SetPoint
        SETPOINT.updateSetPoint(SETPOINT.setPoint)  -- This will refresh the setPoint with current value
        if (Sensor.temperature <= (SETPOINT.setPoint - 0.2)) then -- turn on heat
            domoticz.devices(14).switchOn().checkFirst()
        elseif (Sensor.temperature >= (SETPOINT.setPoint + 0.2)) then -- turn off heat
            domoticz.devices(14).switchOff().checkFirst()
        else
            -- within hysteresis range
        end
    end
}
If I use domoticz/out I will get a text string, which I manipulate using the string object in Node Red.

I would like to read the information the same way from the Xiaomi device, but I'm not sure how to do this.

Can someone help me, please?

Best regards

Ulf

Re: Events from Xiaiomi devices

Posted: Monday 02 March 2020 12:59
by salvacalatayud
Hi,

I'm using node red to send temperature and setpoints to google home, maybe this can help you:

https://www.domoticz.com/forum/viewtopi ... 69&t=27588

Re: Events from Xiaiomi devices

Posted: Monday 02 March 2020 18:52
by ulfh2018
I have now found a solution - it was SO simple, when I finally did the right thing. I use the mqtt/in node connected to domoticz/in at Domoticz. Of course I first had to configure MQTT Remote on Domoticz. The result is formatted via the json parser, and the values picked out via a function. I am using mqtt on another Rpi, since I run into problems with instability when i tried mqtt on the same node where I was running Domoticz and Node-Red.