Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't computed energy Shelly Plus 1 PM #9

Closed
TheReiner opened this issue Apr 17, 2023 · 8 comments
Closed

Can't computed energy Shelly Plus 1 PM #9

TheReiner opened this issue Apr 17, 2023 · 8 comments
Labels
duplicate This issue or pull request already exists waiting Domoticz support

Comments

@TheReiner
Copy link

Hi,

Sorry for my english, but i can't computed energy for my shelly plus 1

Screenshot 2023-04-17 at 10 27 19
Screenshot 2023-04-17 at 10 27 26

and this is my Shelly Dimmer and i have the possibility to computed energy
Screenshot 2023-04-17 at 10 28 08

Did you have an idea?
Many Thanks

@TheReiner TheReiner changed the title Can't computed energy Shelly Plus 1 Can't computed energy Shelly Plus 1 PM Apr 17, 2023
@enesbcs
Copy link
Owner

enesbcs commented Apr 17, 2023

I cant see any difference in the important parameters. Maybe if you enable Domoticz debug log and see what kind of devices it creates for you, it will help.

Shelly Dimmer:
payload={"name": "%shelly_id% Power 0", "stat_t": "~light/0/power", "avty_t": "~online", "pl_avail": "true", "pl_not_avail": "false", "frc_upd": "false", "enabled_by_default": true, "uniq_id": "%shelly_id%-light-power-0", "qos": 0, "~": "shellies/%shelly_id%/", "dev_cla": "power", "stat_cla": "measurement", "unit_of_meas": "W", "val_tpl": "{{value|float|round(1)}}","device": {"identifiers": ["%shelly_mac%"],"manufacturer": "Shelly","model": "%shelly_model%","name": "%shelly_id%"}}

Shelly Plus1PM:
topic=%discovery_prefix%/sensor/%shelly_id%-0/power/config payload={"name": "%shelly_id% Power 0", "stat_t": "~status/switch:0", "frc_upd": "false", "enabled_by_default": true, "uniq_id": "%shelly_id%-0-power", "qos": 0, "~": "%shelly_topic%/", "dev_cla": "power", "stat_cla": "measurement", "unit_of_meas": "W", "val_tpl": "{{ value_json.apower }}", "device": {"identifiers": ["%shelly_mac%-0"],"manufacturer": "Shelly","model": "%shelly_model%","name": "%shelly_id%-0"}}

@TheReiner
Copy link
Author

Sorry, i forget to tell you... for my Shelly Dimmer, i use the old plug-in Shelly MQTT for Domoticz...

@enesbcs
Copy link
Owner

enesbcs commented Apr 17, 2023

The old plugin creates devices for itself, but Domoticz MQTT AD hardware creates the devices in this case.
I guess this is the way how MQTT AD works now.
You can open an issue on Domoticz github for this problem.

@enesbcs enesbcs added invalid This doesn't seem right waiting Domoticz support and removed invalid This doesn't seem right labels Apr 17, 2023
@TheReiner
Copy link
Author

Thanks...

But i think is not a problem from Domoticz...

In SQL (DeviceStatus) my Shelly Plus 1 PM is Type 248 and subtype 1 and option is "1;"
And for my Dimmer... The Type 243 and subtype 29 and Option is "EnergyMeterMode:MQ=="

@enesbcs enesbcs added help wanted Extra attention is needed and removed waiting Domoticz support labels Apr 17, 2023
@enesbcs
Copy link
Owner

enesbcs commented Apr 17, 2023

But i think is not a problem from Domoticz...

MQTT config documentation for "Sensor" type:
https://www.home-assistant.io/integrations/sensor.mqtt/

I see 3 point where we can tell Domoticz which kind of sensor we want:
"dev_cla": "power",
"stat_cla": "measurement",
"unit_of_meas": "W"

And these are the standard device types:
https://developers.home-assistant.io/docs/core/entity/sensor/#available-device-classes

Maybe you can try alter class or state_class to "total_increasing" but as i see in the Domoticz source code, it is only watching for the unit of measurement and creates a specific kind of device if it is "W".

@TheReiner
Copy link
Author

Ok many thanks, maybe it's the solution...
But i don't know the process...

I have changed the template ... in "mqtt_templates_gen2.txt" ans i have deleted in domoticz the device... and i haved exec "python3 shellyteacher4domo.py" is it good ? (new device, but same problem and i think it's not with the new template)

@enesbcs
Copy link
Owner

enesbcs commented Apr 18, 2023

The process is good. You can enable debug in setup.py to see the sent mqtt payloads.. but do not forget to disable debug, after checking.

@enesbcs
Copy link
Owner

enesbcs commented Apr 18, 2023

In SQL (DeviceStatus) my Shelly Plus 1 PM is Type 248 and subtype 1 and option is "1;" And for my Dimmer... The Type 243 and subtype 29 and Option is "EnergyMeterMode:MQ=="

243/29 is a General/Electric (Instant+Counter) device which has a unit of kWh this is created by Domoticz when unit is "kWh" .. and only this kind of device has the option for "Compute".

248/1 is a Usage / Electric device is created by Domoticz MQTT AD when unit is "W"

Most of Shelly devices returns watt-minutes, which needs to be translated to kwh first, but it is currently not supported in Domozicz, see issue:
#6

@enesbcs enesbcs added waiting Domoticz support duplicate This issue or pull request already exists and removed help wanted Extra attention is needed labels Apr 18, 2023
@enesbcs enesbcs closed this as completed Aug 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists waiting Domoticz support
Projects
None yet
Development

No branches or pull requests

2 participants