enesbcs / shellyteacher4domo

Shelly device teacher for Domoticz MQTT Autodiscovery hardware
Apache License 2.0
10 stars 4 forks source link

Gen 1 devices doens't show actual watt in energy device #54

Open rolfie23 opened 3 months ago

rolfie23 commented 3 months ago

Hello,

Was using your old plugin for the gen1 devices and this plugin for the gen 2+3 devices, but with the old plugin and a shelly reboot the total counter resets to 0, which shows a big negative drop in all the charts which can't be removed with the shift click option.

So I wanted to try teacher for the gen1 device, made seperate hardware for gen 1 teacher devices. But when receiving data the gen1 devices total counter counts up, but it doesn't receive the actual power. Naamloos Device with the 2 after the name is from the new plugin and a dimmer 1, but RGBW2 also has the same problem.

Strage thing, on the gen2 and gen 3 devices it just works as expected: Naamlooos This is from a Plus 1PM trough teacher plugin.

What is wrong? and can you help me? So i hope I get rid of the negative spikes!

enesbcs commented 3 months ago

Domoticz version?

rolfie23 commented 3 months ago

Sorry, 2024.4

enesbcs commented 3 months ago

Device with the 2 after the name is from the new plugin and a dimmer 1, but RGBW2 also has the same problem.

RGBW2 in white mode i guess, as color mode is not supported in Teacher.

Although the device only passes Watt and Watt-minute to the MQTT broker (no kWh at all), the value you see at the old plugin is also calculated. You can try to alter the Domoticz device type to "Computed" and see if it works.

https://www.domoticz.com/forum/viewtopic.php?t=15002

rolfie23 commented 3 months ago

Device with the 2 after the name is from the new plugin and a dimmer 1, but RGBW2 also has the same problem.

RGBW2 in white mode i guess, as color mode is not supported in Teacher.

Although the device only passes Watt and Watt-minute to the MQTT broker (no kWh at all), the value you see at the old plugin is also calculated. You can try to alter the Domoticz device type to "Computed" and see if it works.

https://www.domoticz.com/forum/viewtopic.php?t=15002

Yes, RGBW2 in white mode.

But why is it working in gen2 and gen3 devices, but not in gen1 devices? Computed isn't working. Just tested it, and I want everything on from device, but that's more accurately if you compare with the Shelly app.

enesbcs commented 3 months ago

You have to check that your Gen1 device has the latest firmware. If it is, than you can debug MQTT communication, for example with MQTT Explorer, if the necessary Watt information is sent by the Shelly device to the MQTT broker.

rolfie23 commented 3 months ago

You have to check that your Gen1 device has the latest firmware. If it is, than you can debug MQTT communication, for example with MQTT Explorer, if the necessary Watt information is sent by the Shelly device to the MQTT broker.

Latest firmware you mean stable or the beta which there is already a few months? I'm on the latest stable 1.14.0.

rolfie23 commented 3 months ago

The output of the MQTT gen1 is: gen1

The output of the MQTT gen2 in topic shellyplus1pm-b0b21c1b5c0c/status/switch:0 is: {"id":0, "source":"init", "output":true, "apower":6.2, "voltage":238.4, "current":0.042, "aenergy":{"total":22073.159,"by_minute":[101.330,101.739,101.739],"minute_ts":1716626340},"temperature":{"tC":56.0, "tF":132.7}}

The output of the MQTT AD of gen1 is: {"name": "shellydimmer-D0A763 Energy 0", "stat_t": "~light/0/energy", "avty_t": "~online", "pl_avail": "true", "pl_not_avail": "false", "uniq_id": "shellydimmer-D0A763-light-energy-0", "qos": 0, "~": "shellies/shellydimmer-D0A763/", "dev_cla": "energy", "la_te": true, "stat_cla": "total_increasing", "unit_of_meas": "Wm", "device": {"identifiers": ["98F4ABD0A763"],"manufacturer": "Shelly","model": "SHDM-1","name": "shellydimmer-D0A763"}}

The output of MQTT AD gen 2 is: {"name": "shellyplus1pm-b0b21c1b5c0c Energy 0", "stat_t": "~status/switch:0", "uniq_id": "shellyplus1pm-b0b21c1b5c0c-0-energy", "qos": 0, "~": "shellyplus1pm-b0b21c1b5c0c/", "dev_cla": "energy", "la_te": true, "stat_cla": "total_increasing", "unit_of_meas": "Wh", "val_tpl": "{{ value_json['aenergy'].total }}", "device": {"identifiers": ["B0B21C1B5C0C-0"],"manufacturer": "Shelly","model": "shellyplus1pm","name": "shellyplus1pm-b0b21c1b5c0c-0"}}

Only difference I see as a beginner is that gen2 has an val_tpl. More I don't get about it.

Beside from this, I installed the beta on a gen1 device to test, but no difference. But the problem I hope to resolve with Shelly python plugin is also there in the AD plugin.

The device rebooted, but the total counter resets to 0 what is leading to a drop in power graph and totals (now a small one, but the longer it's online the drop is bigger).

Here you see the drop with the python plugin: gen1 python

And here the drop with the AD plugin: gen1 ad

Is this a problem for domoticz, or in the plugin? Because with zigbee and gen2 and 3 devices I don't get these drops.

enesbcs commented 3 months ago

Only difference I see as a beginner is that gen2 has an val_tpl. More I don't get about it.

Indeed "val_tpl" is only needed to Gen2, as it returns data as JSON. Gen1 returns data as simple string.

Beside from this, I installed the beta on a gen1 device to test, but no difference. But the problem I hope to resolve with Shelly python plugin is also there in the AD plugin.

The device rebooted, but the total counter resets to 0 what is leading to a drop in power graph and totals (now a small one, but the longer it's online the drop is bigger).

Then i guess your problem is not plugin related.

Is this a problem for domoticz, or in the plugin? Because with zigbee and gen2 and 3 devices I don't get these drops.

I think you can try to ask your question in the Domoticz forum, maybe some users have idea. I do not have any more.

rolfie23 commented 3 months ago

Indeed "val_tpl" is only needed to Gen2, as it returns data as JSON. Gen1 returns data as simple string.

Okay, logical. Beside from this, I installed the beta on a gen1 device to test, but no difference. But the problem I hope to resolve with Shelly python plugin is also there in the AD plugin. Then i guess your problem is not plugin related.

The problem of counter reset? But the actual watt is your plugin. It's still not clear why gen 2 and 3 devices it works perfect, but with gen 1 not.

I think you can try to ask your question in the Domoticz forum, maybe some users have idea. I do not have any more.

Will do!