Smanar / Domoticz-deCONZ

deCONZ plugin for Domoticz (Zigbee application)
GNU General Public License v3.0
36 stars 27 forks source link

Combine sensors #50

Closed dennisb1 closed 4 years ago

dennisb1 commented 4 years ago

I have a Temp sensor from Xiaomi.

When im reading this out in Domoticz i get 3 devices. Temp, Humidity and Preasure.

Why is this not combinend? With a power meter i have the same issue. When looking in deCONZ i see it as one device and this is the way i want it without any LUA scripts or whatever to get this result.

What am i doing wrong?

Smanar commented 4 years ago

Hello, If you look in deconz I can promise you will see 3 sensors too, so it's not your fault but my choice. You have only 1 device in deconz but in the API you will have 3 sensors, one by endpoint. So you will have for exemple

00:15:8d:00:02:f3:AA:57-01-0402 for temperature 00:15:8d:00:02:f3:AA:57-01-0405 for humidity 00:15:8d:00:02:f3:AA:57-01-0403 for pressure

00:15:8d:00:02:f3:AA:57 is the mac adress. 01 is the endpoint. 0403 is the cluster.

For temperature I can understand the problem, but it same for presence detection + luxmeter and for those I think you will prefer to separete them.

To group them there is an easy LUA script on the bottom of this page (that can work with all your sensors with only one script) > https://github.com/Smanar/Domoticz-deCONZ/wiki/Example-to-make-a-LUA-script-to-mix-temperature-humidity-barometer-on-the-same-sensor

dennisb1 commented 4 years ago

Thank you i will try this right now! Is this not making a huge CPU usage when using this?

From 3% cpu i go to 20% cpu with domoticz... And that with zero sensors, adding 1 sensor dont make a diffrance.

Smanar commented 4 years ago

No the papoo script is realy light. But 20 % is realy hight.

I m always under 5% with domoticz and deconz on the same machine ( A Raspberry 3+ with OS in desktop mode)

Domoticz is a light application too, not normal it increase the cpu usage by 15 %

dennisb1 commented 4 years ago

This is what happens when the script from papoo is running. Its on a Raspberry PI 3 B+ When i turn the script off instant the CPU drops.

https://ibb.co/vqqJnKt https://ibb.co/4gqky2N

Smanar commented 4 years ago

Ok, it s not normal. Pls wait some days before using this script, I will try to pm papoo for more informations.

Smanar commented 4 years ago

Back.

So papoo is agree with me it's not possible. If it's your first dzevent script, you can have more CPU use because Domoticz need to load the dzevent engine but not 13% more

But I m trying it ATM on my machine, the script is invisible (and it's my only dzevent script)

How have you create this script on domoticz ? I have used the buildin engine in setting / more options / event > new dzevent / device and it have created a file in /home/pi/domoticz/scripts/dzVents/generated_scripts

Do you have something written log more than 1 time by second ?

BTW have you tried to disable debug for dzevent, it's something realy cpu intensive. In Setup > Settings > Other > EventSystem

dennisb1 commented 4 years ago

Your correct. This is my first script running (other is a blockly script)

Yes i have created this script using the new dzevent option within Domoticz

I dont have debug log on, its on Error/Minimal/Informal but even lowering dont make a diffrance. I dont see any logging even when i turn debug on in the log section.

But... the scripts works, it updates 2 sensors at this moment with baro/temp/humidity With the CPU i only see it dropping when i turn off this script. Sure, i got the cpu power on the Rpi3B+ but still i find this very strange.

Im afraid it will raise even more when i find a script to combine the Watt/Kwh script for the Innr power plug

As you can see on this image; https://ibb.co/b6VH05B since 14 march deCONZ is running and since 22 march the dzevent script

Smanar commented 4 years ago

On my side I have max 1% more cpu usage with the script (and with enabling dzevent in same time).

I have debug on "silent", else on "debug" It trigger for all devices change, so it spam the log windows. Not normal you don't see any change too !

Can you try with a fake dzevent script, a minimal one like (and disabling the papoo one)

return
{
    on =
    {
        devices = { 'Room switch'}
    },
    execute = function(domoticz, roomSwitch)
        if (roomSwitch.active) then
        domoticz.devices('Another switch').switchOn()
        domoticz.notify('This rocks!',
                        'Turns out that it is getting warm here',
                        domoticz.PRIORITY_LOW)
        end
}

To see if the problem is from the script itself or the DZevent engine loading ?

How many temperature sensor have you ? If you only have few of them, you can use a lua script, perhaps better result.

dennisb1 commented 4 years ago

When i turn it off its back to 3-4% max. When i try your test script the same happens, its 30-35% cpu.

I have 4 temp sensors and i still need to get a script for the innr power plug to combine the wattage and kwh total so i'm not done yet

Thanks for so far!

Smanar commented 4 years ago

Ok, so I think you can ask in domoticz forum for information. This script is realy basic, not normal it increase your cpu consommation by 30% just because you have enabled the dzevent. For me there is a problem either in your configuration either in domoticz itself.

The only thing I know than can provoke that is the debugging (or logs) enabled.

dennisb1 commented 4 years ago

Thank you, i will go try it there!