Closed danichispa closed 8 years ago
Hi!
Since the V_LEVEL type (37) can be used for different sensor types, dust, sound, vibration etc, and also lightlevel, I haven't set a predefined unit for that type. What you can do though, is use an additional v_type V_UNIT_PREFIX (43) together with V_LEVEL. The string value that you send for V_UNIT_PREFIX will be used in preference to any unit of measurement, for the sensors you define it for.
Let me know if you need an example.
Edit: This only works with MySensors version 1.5 and later.
Yes please! :) I suppose this is have to be done on the sensor sketch, right? Thanks in advance!!
Yes, this is all done in the arduino sketch:
...
#define CHILD_ID5 5
...
MyMessage msgUnit(CHILD_ID5, V_UNIT_PREFIX);
MyMessage msgLevel(CHILD_ID5, V_LEVEL);
void setup()
{
...
gw.present(CHILD_ID5, S_LIGHT_LEVEL);
gw.send(msgUnit.set("lux"));
gw.send(msgLevel.set("0"));
}
...
I've just broken out the relevant pieces. You have to fill in the gaps (...).
Thanks @MartinHjelmare !!! Tested and working right now! I close this but left for reference ;)
Hi all, I'm having an issue in MySensors. A BH1750 sensor reporting fine the lux quantity, but it doesn't get the unit of measurement as "lux". This is the log of the sensor from the homeassistant log.
Any idea of how can I get the unit?
Thanks!