This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| projects:internetofthings:esphome [2021/02/19 18:40] – [BLE bluetooth tracker (version 1)] scipio | projects:internetofthings:esphome [2021/07/06 07:26] (current) – [ESP32 cam] scipio | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== ESPHOME ====== | ====== ESPHOME ====== | ||
| + | |||
| + | ===== ESP32 cam ===== | ||
| + | |||
| + | * [[https:// | ||
| + | |||
| + | |||
| + | |||
| + | <code bash> | ||
| + | #!/bin/sh | ||
| + | |||
| + | TOKEN=... | ||
| + | |||
| + | PAYLOAD=" | ||
| + | |||
| + | |||
| + | curl -q -X POST \ | ||
| + | -d " | ||
| + | -H " | ||
| + | -H " | ||
| + | http:// | ||
| + | </ | ||
| + | |||
| + | in esp32 cam this section is missing in " | ||
| + | <code javascript> | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | ], | ||
| + | " | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | } | ||
| + | ], | ||
| + | " | ||
| + | " | ||
| + | ], | ||
| + | " | ||
| + | " | ||
| + | ], | ||
| + | " | ||
| + | " | ||
| + | ] | ||
| + | } | ||
| + | ] | ||
| + | }, | ||
| + | </ | ||
| + | |||
| + | esp32 entry (missing some values) | ||
| + | |||
| + | <code javascript> | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | ], | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | }, | ||
| + | " | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | { | ||
| + | " | ||
| + | } | ||
| + | ], | ||
| + | " | ||
| + | " | ||
| + | } | ||
| + | }, | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | } | ||
| + | ] | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | |||
| + | valid stream camera working in alexa | ||
| + | <code javascript> | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | ], | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | }, | ||
| + | " | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | ], | ||
| + | " | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | } | ||
| + | ], | ||
| + | " | ||
| + | " | ||
| + | ], | ||
| + | " | ||
| + | " | ||
| + | ], | ||
| + | " | ||
| + | " | ||
| + | ] | ||
| + | } | ||
| + | ] | ||
| + | }, | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | { | ||
| + | " | ||
| + | } | ||
| + | ], | ||
| + | " | ||
| + | " | ||
| + | } | ||
| + | }, | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | } | ||
| + | ] | ||
| + | } | ||
| + | |||
| + | </ | ||
| + | ===== BLE tracker smartband ===== | ||
| + | |||
| + | ==== esphome ==== | ||
| + | |||
| + | enable esp32_ble_tracker and a binary sensor on ble_presence | ||
| + | < | ||
| + | esp32_ble_tracker: | ||
| + | |||
| + | binary_sensor: | ||
| + | - platform: ble_presence | ||
| + | mac_address: | ||
| + | id: miband_presence_scipio | ||
| + | name: " | ||
| + | </ | ||
| + | |||
| + | ==== hass ==== | ||
| + | |||
| + | automation directly on sensor created by esphome | ||
| + | < | ||
| + | - alias: cancello | ||
| + | trigger: | ||
| + | - entity_id: binary_sensor.miband_presence_scipio | ||
| + | platform: state | ||
| + | to: ' | ||
| + | for: | ||
| + | seconds: 2 | ||
| + | - entity_id: binary_sensor.miband_presence_scipio | ||
| + | platform: state | ||
| + | to: ' | ||
| + | for: | ||
| + | seconds: 2 | ||
| + | action: | ||
| + | - service: notify.alexa_media | ||
| + | data_template: | ||
| + | message: > | ||
| + | {% if is_state(' | ||
| + | ' | ||
| + | {% else %} | ||
| + | ' | ||
| + | {% endif %} | ||
| + | data: | ||
| + | type: announce | ||
| + | method: all | ||
| + | target: | ||
| + | - show | ||
| + | - Echo | ||
| + | </ | ||
| + | |||
| + | |||
| + | example of added binary sensor defined on ble sensor | ||
| + | < | ||
| + | binary_sensor: | ||
| + | - platform: template | ||
| + | sensors: | ||
| + | miband_scipio_sticky: | ||
| + | value_template: | ||
| + | {{is_state(' | ||
| + | delay_off: 60 | ||
| + | </ | ||
| + | |||
| ===== BLE bluetooth tracker (version 1) ===== | ===== BLE bluetooth tracker (version 1) ===== | ||
| - | hass | + | hass input_boolean: |
| <code yaml> | <code yaml> | ||
| - | input_text: | + | beacon2_learn: |
| - | | + | name: learn beacon2 |
| - | | + | initial: |
| - | initial: | + | icon: mdi: |
| - | + | ||
| - | scripts: | + | beacon2_active: |
| - | | + | |
| - | | + | icon: mdi:mdi-account-check |
| - | - condition: template | + | |
| - | | + | beacon2_trigger: |
| - | - service: input_text.set_value | + | name: beacon2 is now detected |
| - | | + | |
| - | | + | icon: mdi: |
| - | value: "{{ ibeacon }}" | + | |
| </ | </ | ||
| + | hass input_text: | ||
| + | < | ||
| + | beacon1: | ||
| + | name: BLE beacon1 | ||
| + | |||
| + | beacon2: | ||
| + | name: BLE beacon2 | ||
| + | </ | ||
| + | |||
| + | hass scripts: | ||
| + | < | ||
| + | set_ibeacon: | ||
| + | sequence: | ||
| + | - condition: template | ||
| + | value_template: | ||
| + | - service: script.set_beacon1 | ||
| + | data_template: | ||
| + | ibeacon: "{{ ibeacon }}" | ||
| + | - service: script.set_beacon2 | ||
| + | data_template: | ||
| + | ibeacon: "{{ ibeacon }}" | ||
| + | |||
| + | set_beacon2: | ||
| + | sequence: | ||
| + | - service: script.beacon2_active | ||
| + | data_template: | ||
| + | ibeacon: "{{ ibeacon }}" | ||
| + | - condition: state | ||
| + | entity_id: input_boolean.beacon2_learn | ||
| + | state: " | ||
| + | - service: input_text.set_value | ||
| + | data_template: | ||
| + | entity_id: input_text.beacon2 | ||
| + | value: "{{ ibeacon }}" | ||
| + | - service: input_boolean.turn_off | ||
| + | entity_id: input_boolean.beacon2_learn | ||
| + | |||
| + | beacon2_active: | ||
| + | sequence: | ||
| + | - condition: template | ||
| + | value_template: | ||
| + | - service: input_boolean.turn_on | ||
| + | entity_id: input_boolean.beacon2_trigger | ||
| + | - delay: 1 | ||
| + | - service: input_boolean.turn_off | ||
| + | entity_id: input_boolean.beacon2_trigger | ||
| + | |||
| + | |||
| + | </ | ||
| + | |||
| + | |||
| + | | ||
| + | hass automations: | ||
| + | < | ||
| + | - alias: " | ||
| + | trigger: | ||
| + | platform: state | ||
| + | entity_id: input_sensor.beacon2_trigger | ||
| + | to: " | ||
| + | condition: | ||
| + | condition: state | ||
| + | entity_id: input_boolean.beacon2_active | ||
| + | state: " | ||
| + | action: | ||
| + | - service: input_boolean.turn_on | ||
| + | entity_id: input_boolean.beacon2_active | ||
| + | - service: notify.alexa_media | ||
| + | data: | ||
| + | message: " | ||
| + | data: | ||
| + | type: announce | ||
| + | method: all | ||
| + | target: | ||
| + | - show | ||
| + | - Echo | ||
| + | |||
| + | - alias: " | ||
| + | trigger: | ||
| + | platform: state | ||
| + | entity_id: input_boolean.beacon2_trigger | ||
| + | to: " | ||
| + | for: 140 | ||
| + | action: | ||
| + | - service: input_boolean.turn_off | ||
| + | entity_id: input_boolean.beacon2_active | ||
| + | - service: notify.alexa_media | ||
| + | data: | ||
| + | message: " | ||
| + | data: | ||
| + | type: announce | ||
| + | method: all | ||
| + | target: | ||
| + | - show | ||
| + | - Echo | ||
| + | </ | ||
| + | |||
| + | panel | ||
| + | <code yaml> | ||
| + | type: entities | ||
| + | entities: | ||
| + | - entity: input_boolean.beacon2_learn | ||
| + | - entity: input_text.beacon2 | ||
| + | - entity: input_boolean.beacon2_trigger | ||
| + | - entity: input_boolean.beacon2_active | ||
| + | title: Tracker cancello | ||
| + | </ | ||
| esphome | esphome | ||