HI,
I have a dragino LPS8N successfully running with two LHT65N. I happily got it to run without exposing any data to any cloud.
My config.yaml for one of them as an example looks like:
mqtt:
sensor:
# Dragino Gateway dragino-27xxx8 sensors
# Sensor-2
- name: "dragino-27xxx8-018DDDE3-temp-2"
state_topic: "homeassistant/dragino-27xxx8/018DDDE3/data"
value_template: '{{ value_json.TempC_SHT }}'
unit_of_measurement: '°C'
unique_id: dragino-27xxx8-018DDDE3-temp-2
- name: "dragino-27xxx8-018DDDE3-hum-2"
state_topic: "homeassistant/dragino-27xxx8/018DDDE3/data"
value_template: '{{ value_json.Hum_SHT }}'
unit_of_measurement: '%'
unique_id: dragino-27xxx8-018DDDE3-hum-2
- name: "dragino-27xxx8-018DDDE3-bat-stat-2"
state_topic: "homeassistant/dragino-27xxx8/018DDDE3/data"
value_template: '{{ value_json.Bat_status }}'
unit_of_measurement: 'kg'
unique_id: dragino-27xxx8-018DDDE3-bat-stat-2
The sensor data payload looks like
{"Bat_status":3,"TempC_SHT":-18.91,"SNR":8.2,"Hum_SHT":55.5,"EXT":"Illumination Sensor","RSSI":-75,"ext_sensor":1,"ILL_lux":65535,"BatV":2.959}
The last is the battery status, which has int value from 0-3, indicating the battery status from poor to perfect. I know, that this is not measured in “kg”, but I wanted to see it, “somehow”.
My question: As I configured it, it seems to be 4 sensors to HA, but in fact, it is one sensor, (018DDDE3) which has multiple values.
I have the feeling, that I could add such one sensor much smarter, than I do it, but I did not understand how to “glue” it together, I think my main problem is to understand how the payload can be extracted within HA.
What recommended way is there to read this data and give it more senseful units_of_measurement e.g. or how to add a device class to this…
many thanks
Juergen