Ik heb in home assistant al presence detection via tado en wifi (unifi controller)
Dat werkt perfect. HA geeft per gebruiker mooi weer of die thuis is of niet.
Maar ik zou willen weten op welke AP deze geconnecteerd is. Op internet vind ik niet dadelijk antwoorden.
HA presence detection, welke AP connected
-
- Elite Poster
- Berichten: 3202
- Lid geworden op: 05 dec 2010, 15:09
- Bedankt: 450 keer
- devilkin
- Administrator
- Berichten: 7123
- Lid geworden op: 17 mei 2006, 20:10
- Uitgedeelde bedankjes: 1088 keer
- Bedankt: 696 keer
- Recent bedankt: 12 keer
Ik heb zoiets gebouwd, en dat werkt... maar het is niet echt vriendelijk als je met veel mensen zit die je wilt tracken.
Ik baseer me op de new_state.attributes.ap_mac, en dus het MAC adres van het AP.
Ik baseer me op de new_state.attributes.ap_mac, en dus het MAC adres van het AP.
Code: Selecteer alles
[{"id":"3eb38d5e.e59912","type":"inject","z":"a14cb62d.365d4","name":"Study","topic":"","payload":"{\"entity_id\":\"device_tracker.oneplus6\",\"old_state\":{\"state\":\"home\",\"attributes\":{\"ap_mac\":\"xx:xx:xx:xx:xx:xx\"}},\"new_state\":{\"state\":\"home\",\"attributes\":{\"ap_mac\":\"xx:xx:xx:xx:xx:xx\"}}}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":90,"y":60,"wires":[["3add9afa.c1b24e"]]},{"id":"3add9afa.c1b24e","type":"trigger-state","z":"a14cb62d.365d4","name":"OP6 Tracker","server":"5f01146c.501bec","entityid":"device_tracker.oneplus6","entityidfiltertype":"exact","debugenabled":false,"constraints":[{"id":"m4yph6mr2nm","targetType":"this_entity","targetValue":"","propertyType":"current_state","propertyValue":"new_state.state","comparatorType":"is","comparatorValueDatatype":"str","comparatorValue":"home"}],"constraintsmustmatch":"all","outputs":4,"customoutputs":[{"outputId":"sikaxqno59","messageType":"payload","messageValue":"livingroom","messageValueType":"json","comparatorPropertyType":"property","comparatorPropertyValue":"new_state.attributes.ap_mac","comparatorType":"is","comparatorValue":"yy:yy:yy:yy:yy:yy"},{"outputId":"ty0ja2o5qb","messageType":"payload","messageValue":"study","messageValueType":"json","comparatorPropertyType":"property","comparatorPropertyValue":"new_state.attributes.ap_mac","comparatorType":"is","comparatorValue":"xx:xx:xx:xx:xx:xx"}],"outputinitially":false,"state_type":"str","x":270,"y":100,"wires":[[],["3ad64e68.958912"],["438ebcf5.f387ec"],["438ebcf5.f387ec"]]},{"id":"bd7a4d76.aa72c8","type":"api-current-state","z":"a14cb62d.365d4","name":"Livingroom lamp on?","server":"5f01146c.501bec","version":1,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"light.ikea_lights_livingroom","state_type":"str","state_location":"","override_payload":"none","entity_location":"","override_data":"none","blockInputOverrides":false,"x":380,"y":460,"wires":[["3af0f039.7ebe48"],[]]},{"id":"ff433ddb.8215a","type":"api-current-state","z":"a14cb62d.365d4","name":"Diningroom lamp on?","server":"5f01146c.501bec","version":1,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"light.ikea_lights_diningroom","state_type":"str","state_location":"","override_payload":"none","entity_location":"","override_data":"none","blockInputOverrides":false,"x":380,"y":520,"wires":[["6a3e012c.f55e5"],[]]},{"id":"6a3e012c.f55e5","type":"api-call-service","z":"a14cb62d.365d4","name":"Switch diningroom lamp brightness","server":"5f01146c.501bec","version":1,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.ikea_lights_diningroom","data":"{ \"brightness\": {{payload}}, \"transition\": 5}","dataType":"json","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":680,"y":520,"wires":[["7117463a.2adef8"]]},{"id":"3af0f039.7ebe48","type":"api-call-service","z":"a14cb62d.365d4","name":"Switch livingroom lamp brightness","server":"5f01146c.501bec","version":1,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.ikea_lights_livingroom","data":"{ \"brightness\": {{payload}}, \"transition\": 5}","dataType":"json","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":680,"y":460,"wires":[["7117463a.2adef8"]]},{"id":"7117463a.2adef8","type":"debug","z":"a14cb62d.365d4","name":"Lamp output","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":970,"y":480,"wires":[]},{"id":"1ec5cb28.c96d1d","type":"inject","z":"a14cb62d.365d4","name":"Livingroom","topic":"","payload":"{\"entity_id\":\"device_tracker.oneplus6\",\"old_state\":{\"state\":\"home\",\"attributes\":{\"ap_mac\":\"yy:yy:yy:yy:yy:yy\"}},\"new_state\":{\"state\":\"home\",\"attributes\":{\"ap_mac\":\"yy:yy:yy:yy:yy:yy\"}}}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":100,"y":100,"wires":[["3add9afa.c1b24e"]]},{"id":"d6e0a2a9.82b67","type":"inject","z":"a14cb62d.365d4","name":"Study","topic":"","payload":"{\"entity_id\":\"device_tracker.oneplus_5t\",\"old_state\":{\"state\":\"home\",\"attributes\":{\"ap_mac\":\"xx:xx:xx:xx:xx:xx\"}},\"new_state\":{\"state\":\"home\",\"attributes\":{\"ap_mac\":\"xx:xx:xx:xx:xx:xx\"}}}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":90,"y":260,"wires":[["9fa5639b.a10048"]]},{"id":"5f776fc4.beaf9","type":"inject","z":"a14cb62d.365d4","name":"Livingroom","topic":"","payload":"{\"entity_id\":\"device_tracker.oneplus_5t\",\"old_state\":{\"state\":\"home\",\"attributes\":{\"ap_mac\":\"yy:yy:yy:yy:yy:yy\"}},\"new_state\":{\"state\":\"home\",\"attributes\":{\"ap_mac\":\"yy:yy:yy:yy:yy:yy\"}}}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":100,"y":300,"wires":[["9fa5639b.a10048"]]},{"id":"438ebcf5.f387ec","type":"function","z":"a14cb62d.365d4","name":"Store location","func":"if (msg.topic == \"device_tracker.oneplus_5t\") {\n flow.set(\"op5t\", msg.payload);\n} else if (msg.topic == \"device_tracker.oneplus6\") {\n flow.set(\"op6\", msg.payload);\n}\n\nreturn msg;","outputs":1,"noerr":0,"x":500,"y":180,"wires":[["cc7cf062.72b158"]]},{"id":"cc7cf062.72b158","type":"function","z":"a14cb62d.365d4","name":"Determine brightness","func":"var brightness = 1;\nvar max_brightness = 216;\n\nvar dev1 = flow.get('op5t') || '';\nvar dev2 = flow.get('op6') || '';\n\nif (dev1 == \"livingroom\" || dev2 == \"livingroom\") {\n brightness = max_brightness;\n}\n\nvar newmsg = { payload: brightness }; \nreturn newmsg;","outputs":1,"noerr":0,"x":700,"y":180,"wires":[["bd7a4d76.aa72c8","ff433ddb.8215a","5ffe467b.bc1e1"]]},{"id":"3ad64e68.958912","type":"change","z":"a14cb62d.365d4","name":"Clear OP6 location","rules":[{"t":"delete","p":"op6","pt":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":510,"y":60,"wires":[[]]},{"id":"74ade5db.400c5c","type":"change","z":"a14cb62d.365d4","name":"Clear OP5T location","rules":[{"t":"delete","p":"op5t","pt":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":520,"y":260,"wires":[[]]},{"id":"7451b8f8.a5fe78","type":"inject","z":"a14cb62d.365d4","name":"Away","topic":"","payload":"{\"entity_id\":\"device_tracker.oneplus6\",\"old_state\":{\"state\":\"away\",\"attributes\":{\"ap_mac\":\"yy:yy:yy:yy:yy:yy\"}},\"new_state\":{\"state\":\"away\",\"attributes\":{\"ap_mac\":\"yy:yy:yy:yy:yy:yy\"}}}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":90,"y":140,"wires":[["3add9afa.c1b24e"]]},{"id":"5ea4c433.72dcec","type":"inject","z":"a14cb62d.365d4","name":"Away","topic":"","payload":"{\"entity_id\":\"device_tracker.oneplus_5t\",\"old_state\":{\"state\":\"away\",\"attributes\":{\"ap_mac\":\"yy:yy:yy:yy:yy:yy\"}},\"new_state\":{\"state\":\"away\",\"attributes\":{\"ap_mac\":\"yy:yy:yy:yy:yy:yy\"}}}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":90,"y":340,"wires":[["9fa5639b.a10048"]]},{"id":"9fa5639b.a10048","type":"trigger-state","z":"a14cb62d.365d4","name":"OP5T Tracker","server":"5f01146c.501bec","entityid":"device_tracker.oneplus_5t","entityidfiltertype":"exact","debugenabled":false,"constraints":[{"id":"m4yph6mr2nm","targetType":"this_entity","targetValue":"","propertyType":"current_state","propertyValue":"new_state.state","comparatorType":"is","comparatorValueDatatype":"str","comparatorValue":"home"}],"constraintsmustmatch":"all","outputs":4,"customoutputs":[{"outputId":"sikaxqno59","messageType":"payload","messageValue":"livingroom","messageValueType":"json","comparatorPropertyType":"property","comparatorPropertyValue":"new_state.attributes.ap_mac","comparatorType":"is","comparatorValue":"yy:yy:yy:yy:yy:yy"},{"outputId":"ty0ja2o5qb","messageType":"payload","messageValue":"study","messageValueType":"json","comparatorPropertyType":"property","comparatorPropertyValue":"new_state.attributes.ap_mac","comparatorType":"is","comparatorValue":"xx:xx:xx:xx:xx:xx"}],"outputinitially":false,"state_type":"str","x":280,"y":300,"wires":[[],["74ade5db.400c5c"],["438ebcf5.f387ec"],["438ebcf5.f387ec"]]},{"id":"5ffe467b.bc1e1","type":"debug","z":"a14cb62d.365d4","name":"Brightness","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":940,"y":180,"wires":[]},{"id":"5f01146c.501bec","type":"server","z":"","name":"Home Assistant"}]
Telenet All-Internet -- using CV8560E & OPNsense on PCEngines APU2E4
Proximus & Mobile Vikings -- Using OnePlus 8 Pro (ROM: Stock)
Proximus & Mobile Vikings -- Using OnePlus 8 Pro (ROM: Stock)
- bitbite
- Premium Member
- Berichten: 562
- Lid geworden op: 18 dec 2012, 14:01
- Uitgedeelde bedankjes: 38 keer
- Bedankt: 42 keer
Hoe debug je eigenlijk de presence detection? 'k Heb hier een setup die schitterend werkt (openwrt en mikrotik), behalve voor mijn eigen gsm (mijn vrouw lukt bvb probleemloos) hoewel die client gewoon in het lijstje staat op de AP's. Eigenlijk weet ik gewoon niet waar te beginnen.
- devilkin
- Administrator
- Berichten: 7123
- Lid geworden op: 17 mei 2006, 20:10
- Uitgedeelde bedankjes: 1088 keer
- Bedankt: 696 keer
- Recent bedankt: 12 keer
Trial en error... Disconnect gsm, zie wat het geeft, input injection in node red,...
Sent from my ONEPLUS A6003 using Tapatalk
Sent from my ONEPLUS A6003 using Tapatalk
Telenet All-Internet -- using CV8560E & OPNsense on PCEngines APU2E4
Proximus & Mobile Vikings -- Using OnePlus 8 Pro (ROM: Stock)
Proximus & Mobile Vikings -- Using OnePlus 8 Pro (ROM: Stock)
-
- Elite Poster
- Berichten: 1419
- Lid geworden op: 22 mei 2003, 20:23
- Locatie: Gent
- Uitgedeelde bedankjes: 52 keer
- Bedankt: 116 keer
Thx. dat werkt idd zoals het hoort.devilkin schreef:Ik heb zoiets gebouwd, en dat werkt... maar het is niet echt vriendelijk als je met veel mensen zit die je wilt tracken.
Ik baseer me op de new_state.attributes.ap_mac, en dus het MAC adres van het AP.
Bitbite,
Staat je telefoon in de known devices.yaml?
-
- Elite Poster
- Berichten: 1419
- Lid geworden op: 22 mei 2003, 20:23
- Locatie: Gent
- Uitgedeelde bedankjes: 52 keer
- Bedankt: 116 keer
devilkin schreef:Ik heb zoiets gebouwd, en dat werkt... maar het is niet echt vriendelijk als je met veel mensen zit die je wilt tracken.
Ik baseer me op de new_state.attributes.ap_mac, en dus het MAC adres van het AP.
Code: Selecteer alles
[/quote] Wat doet diet blocked en allowed uitgang van die trigger? Op de debugger zie ik daar niets verschijnen.