@Cloolalang wrote:
Hassio configuration
json templating with jinja - processing incoming data.
How to loop through a json values array to trigger a sensor.
value_template syntax:Hassio: 0.100.2
R Pi.Device: NodeMCU with WIFI Sniffer:
https://github.com/SensorsIot/Wi-Fi-Sniffer-as-a-Human-detector/tree/master/WiFi_Sniffer
Hey all,
Im wondering if anyone smarter than me (most of you) can help me quickly;
I want an alternative device tracker for my HA setup, sniffing all probe requests in my location.
My sniffer is up and running but now I need to extract the MAC address data for my sensor.
I need help with the json value template:
The Sniffer sends the following json over MQTT
{ "MAC": [ "b8:69:f4:0c:3a:7b", "ba:69:f4:0c:3a:7b", "80:7d:3a:42:d4:1b", "3c:15:c2:e9:16:08", "4c:17:44:04:ed:d4", "d8:0f:99:82:08:14" ] }
I need to extract these MAC address out to trigger a sensor if a particular MAC address is anywhere in the array, Im not sure how to write the syntax so it loops through the array
something like this:
- platform: mqtt name: "My mother-in-law in in the area!" state_topic: "Sniffer" value_template: >- {%for i = 0; i < MAC.length; i++; x += MAC[i]%} {%- endfor %} payload_on: "b8:69:f4:0c:3a:7b" payload_off: qos: 1
Cheers
P
Posts: 3
Participants: 2