I have a Smart Meter, which I read with SMLReader from Github, delivering the data via MQTT.
It is pushing the power meter data in Wh, not kWh.
Of course, it is open source and I could change it, but is there another way to change it in Homey?
What would be the best way? A virtual device with some flow?
For me the easiest way would be a scaling factor in the MQTT device, but I don’t see this possibility.
You’re not the first to ask for this functionality in the MQTT Device. I’ll consider adding mathjs to the mix. So allow a calculation/expression somehow to transform the incoming message to the correct capability format.
Create a virtual device with the measure_power capability
Use the ‘on message received’ flow card from the MQTT Client app, to listen to the mqtt topic containing the power value.
(If JSON) grab the value from the JSON input
Convert Wh to kWh
Update the capability of the virtual device
Repeat for all capabilities of the device
This is exactly what the MQTT device from the MQTT Hub handles for you. Of course with the exception of the conversion (step 4), hence this thread. Adding this as a configuration option for the MQTT Device is a valid request.