Hi Guys & Girls
I have a Things network Node,
It has build in sensors for Temp, Lux, voltage of battery, etc.
I have managed to set up the Things network integration in Homeassistant.
Most sensors are giving the right data, like temp battery etc.
The only thing which is not giving the right data in Home assistant is the a sensor called “event”’
That one should notify me of movent, button pressed etc.
Below is a entry i made in my config file :
sensor 5:
- platform: thethingsnetwork
device_id: bergingtemp
values:
battery: V
light: Lux
temperature: C
event: "button"
In my Things network payload settings i have this for this node sensor :
function Decoder(bytes, port) {
var decoded = {};
var events = {
1: 'setup',
2: 'interval',
3: 'motion',
4: 'button'
};
decoded.event = events[port];
decoded.battery = (bytes[0] << 8) + bytes[1];
decoded.light = (bytes[2] << 8) + bytes[3];
if (bytes[4] & 0x80)
decoded.temperature = ((0xffff << 16) + (bytes[4] << 8) + bytes[5]) / 100;
else
decoded.temperature = ((bytes[4] << 8) + bytes[5]) / 100;
return decoded;
In home asisstent if i look up the Entity state atributes is shows :
device_id: bergingtemp
raw: DcwABwh5
time: '2021-02-08T19:21:31.927257164Z'
unit_of_measurement: interval
friendly_name: bergingtemp event
Got a tip that i might have to use a template sensor, only i dont have a clue how to that.
My goal is to have a sensor which displays the “event” status , like “button”, “interval”, “motion”
Been googling my ass of but did not find a solution
Hope you can help
Karel