-
PROBLEM DESCRIPTIONI've got a few Tasmota devices autodiscovered by Home Assistant (from integration Tasmota and fritz). The power plug measurements are shown in HA with their correct unit (e.g. kWh): My house meters are read by SML and they don't carry any unit in HA: REQUESTED INFORMATIONMake sure your have performed every step and checked the applicable boxes before submitting your issue. Thank you!
Configuration output here:
Rules output here:
STATUS 0 output here:
Console output here:
TO REPRODUCESteps to reproduce the behavior:
EXPECTED BEHAVIOURA clear and concise description of what you expected to happen.
SCREENSHOTSIf applicable, add screenshots to help explain your problem. ADDITIONAL CONTEXTAdd any other context about the problem here. (Please, remember to close the issue when the problem has been addressed) |
Beta Was this translation helpful? Give feedback.
Replies: 11 comments 1 reply
-
Why would it be a Tasmota problem? |
Beta Was this translation helpful? Give feedback.
-
Because non-SML devices are working properly and SML devices do not. Thus I think I made something wrong with Tasmota. |
Beta Was this translation helpful? Give feedback.
-
No you didn't. The issue is that hatasmota only adds units to predefined names like power, voltage and energy. Your SML names are unknown to hatasmota and therefor you'll need to find a way to tell hass what unit they need. |
Beta Was this translation helpful? Give feedback.
-
And Tasmota will only automatically include a unit indication in the payloads in cases where you have a configuration option to select which unit you want to use, like C/F or hPa/mmHg. In other cases, the intention is to always use the same unit for same type of measure across sensors, which often would by default be the most common unit to use, like when humidity is %RH. |
Beta Was this translation helpful? Give feedback.
-
A workaround is to define a template sensor in Home Assistant's
But this causes unnecessary data duplication (if complete sensor domain is included in InfluxDB) and does not provide historical values (from real sensor to template sensor). @arendst As you said the problem is within the sensor.py to only add units to predefined names. There's already an old hatasmota issue asking for improvement. @sfromis How can I configure to manually include my units in the payload? @gemu2015 Could the script generate a custom MQTT message including the configured units? |
Beta Was this translation helpful? Give feedback.
-
There is no option to add unit specifications to the standard SENSOR payloads. But if you generate your own JSON payloads, you can put whatever there, both from rules, Berry or scripting. Anyway, if hatasmota is to recognize the relation between added unit types (similar to existing units) and specific fields, it would still need modification to recognize the specific fields names. This would not be useful for fields where the unit is always kWh. Or a quite different type of payload structure to indicate what field has what unit. |
Beta Was this translation helpful? Give feedback.
-
Do you have an example payload containing unit specifications? |
Beta Was this translation helpful? Give feedback.
-
Nothing in the JSON to establish that "TempUnit" is for "Temperature" and "DewPoint". "PressureUnit" is for "Pressure" and "SeaPressure". Hence just adding further units in the same location is a waste of time, without the relationship being established elsewhere, and still does not make much sense if the unit is invariably "KWh". As long as the payload format does not separately include a unit specification for each field, the backend (like hatasmota) needs metadata to derive units, no matter if the payload does have units already without these being linked to specific fields. Also illustrative that the sample has no unit for Illuminance, as this is meant to always be lux. Such implicit units are the norm for all Tasmota sensor fields, except for the few ones where Tasmota has options to choose unit. |
Beta Was this translation helpful? Give feedback.
-
I'm using SML which provides arbitrary units (not invariably "KWh"). The way to go is like this (as I understood it):
|
Beta Was this translation helpful? Give feedback.
-
This will not be done
since it consumes resources in flash and ram and it is a breaking change. |
Beta Was this translation helpful? Give feedback.
-
I use old mqtt discovery and UfsRun https://github.com/nikito7/easyhan/blob/dev/edpbox/eb1-discovery2.txt |
Beta Was this translation helpful? Give feedback.
No you didn't. The issue is that hatasmota only adds units to predefined names like power, voltage and energy. Your SML names are unknown to hatasmota and therefor you'll need to find a way to tell hass what unit they need.