projects:internetofthings:esphome

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
projects:internetofthings:esphome [2021/02/26 06:19] – [ESPHOME] scipioprojects:internetofthings:esphome [2021/07/06 07:26] (current) – [ESP32 cam] scipio
Line 1: Line 1:
 ====== ESPHOME ====== ====== ESPHOME ======
  
 +===== ESP32 cam =====
 +
 +  * [[https://github.com/esphome/esphome/pull/1905|rtsp into esp32cam progress]]
 +
 +
 +
 +<code bash>
 +#!/bin/sh
 +
 +TOKEN=...
 +
 +PAYLOAD="{\"directive\": {\"header\": {\"namespace\": \"Alexa.Discovery\", \"name\": \"Discover\", \"payloadVersion\": \"3\", \"messageId\": \"8db404f7-f5a1-495e-9a30-3a8af3bf94e0\"}, \"payload\": {\"scope\": {\"type\": \"BearerToken\", \"token\": \"...\"}}}}"
 +
 +
 +curl -q -X POST \
 +  -d "$PAYLOAD" \
 +  -H "Authorization: Bearer $TOKEN" \
 +  -H "Content-Type: application/json" \
 +  http://localhost:8123/api/alexa/smart_home | jq '.event.payload.endpoints[] | select(.displayCategories[0]=="CAMERA")'
 +</code>
 +
 +in esp32 cam this section is missing in "capabilities"
 +<code javascript>
 +{
 +      "type": "AlexaInterface",
 +      "interface": "Alexa.CameraStreamController",
 +      "version": "3",
 +      "cameraStreamConfigurations": [
 +        {
 +          "protocols": [
 +            "HLS"
 +          ],
 +          "resolutions": [
 +            {
 +              "width": 1280,
 +              "height": 720
 +            }
 +          ],
 +          "authorizationTypes": [
 +            "NONE"
 +          ],
 +          "videoCodecs": [
 +            "H264"
 +          ],
 +          "audioCodecs": [
 +            "AAC"
 +          ]
 +        }
 +      ]
 +    },
 +</code>
 +
 +esp32 entry (missing some values)
 +
 +<code javascript>
 +{
 +  "displayCategories": [
 +    "CAMERA"
 +  ],
 +  "cookie": {},
 +  "endpointId": "camera#citofono",
 +  "friendlyName": "citofono",
 +  "description": "camera.citofono via Home Assistant",
 +  "manufacturerName": "Home Assistant",
 +  "additionalAttributes": {
 +    "manufacturer": "Home Assistant",
 +    "model": "camera",
 +    "softwareVersion": "2021.6.6",
 +    "customIdentifier": "-camera.citofono"
 +  },
 +  "capabilities": [
 +    {
 +      "type": "AlexaInterface",
 +      "interface": "Alexa.EndpointHealth",
 +      "version": "3",
 +      "properties": {
 +        "supported": [
 +          {
 +            "name": "connectivity"
 +          }
 +        ],
 +        "proactivelyReported": true,
 +        "retrievable": true
 +      }
 +    },
 +    {
 +      "type": "AlexaInterface",
 +      "interface": "Alexa",
 +      "version": "3"
 +    }
 +  ]
 +}
 +</code>
 +
 +
 +valid stream camera working in alexa
 +<code javascript>
 +{
 +  "displayCategories": [
 +    "CAMERA"
 +  ],
 +  "cookie": {},
 +  "endpointId": "camera#cancello",
 +  "friendlyName": "camera cancello",
 +  "description": "camera.cancello via Home Assistant",
 +  "manufacturerName": "Home Assistant",
 +  "additionalAttributes": {
 +    "manufacturer": "Home Assistant",
 +    "model": "camera",
 +    "softwareVersion": "2021.6.6",
 +    "customIdentifier": "-camera.cancello"
 +  },
 +  "capabilities": [
 +    {
 +      "type": "AlexaInterface",
 +      "interface": "Alexa.CameraStreamController",
 +      "version": "3",
 +      "cameraStreamConfigurations": [
 +        {
 +          "protocols": [
 +            "HLS"
 +          ],
 +          "resolutions": [
 +            {
 +              "width": 1280,
 +              "height": 720
 +            }
 +          ],
 +          "authorizationTypes": [
 +            "NONE"
 +          ],
 +          "videoCodecs": [
 +            "H264"
 +          ],
 +          "audioCodecs": [
 +            "AAC"
 +          ]
 +        }
 +      ]
 +    },
 +    {
 +      "type": "AlexaInterface",
 +      "interface": "Alexa.EndpointHealth",
 +      "version": "3",
 +      "properties": {
 +        "supported": [
 +          {
 +            "name": "connectivity"
 +          }
 +        ],
 +        "proactivelyReported": true,
 +        "retrievable": true
 +      }
 +    },
 +    {
 +      "type": "AlexaInterface",
 +      "interface": "Alexa",
 +      "version": "3"
 +    }
 +  ]
 +}
 +
 +</code>
 ===== BLE tracker smartband ===== ===== BLE tracker smartband =====
  
Line 64: Line 227:
 ===== BLE bluetooth tracker (version 1) ===== ===== BLE bluetooth tracker (version 1) =====
  
-hass+hass input_boolean:
 <code yaml> <code yaml>
-input_boolean+beacon2_learn
-  allarme: +  name: learn beacon2 
-    name: allarme armato +  initial: off 
-    initial: off +  icon: mdi:mdi-tag-plus
-    icon: mdi:alarm-plus+
  
-  beacon1+beacon2_active
-    name: learn beacon1 +  name: beacon2 is recently seen 
-    initial: off +  icon: mdi:mdi-account-check
-    icon: mdi:mdi-tag-plus+
  
-  beacon2+beacon2_trigger
-    name: learn beacon2 +  name: beacon2 is now detected 
-    initial: off +  initial: off 
-    icon: mdi:mdi-tag-plus+  icon: mdi:mdi-account-check 
 +</code>
  
-  beacon1_active+hass input_text
-    name: beacon1 is detected +<code> 
-    iconmdi:mdi-account-check+beacon1: 
 +  nameBLE beacon1
  
-  beacon2_active+beacon2
-    name: beacon2 is detected +  name: BLE beacon2 
-    icon: mdi:mdi-account-check+</code>
  
-input_text+hass scripts: 
-  beacon1+<code> 
-    nameBLE beacon1 +set_ibeacon
-  beacon2+  sequence
-    nameBLE beacon2 +    - conditiontemplate 
-    +      value_template"{{ ibeacon != '' }}" 
 +    - servicescript.set_beacon1 
 +      data_template: 
 +        ibeacon: "{{ ibeacon }}" 
 +    - service: script.set_beacon2 
 +      data_template: 
 +        ibeacon: "{{ ibeacon }}"
  
-scripts+set_beacon2
-  set_ibeacon+  sequence
-    sequence+    - servicescript.beacon2_active 
-      - conditiontemplate +      data_template
-        value_template: "{{ ibeacon != '' }}" +        ibeacon: "{{ ibeacon }}" 
-      servicescript.set_beacon1 +    conditionstate 
-        data_template+      entity_idinput_boolean.beacon2_learn 
-          ibeacon: "{{ ibeacon }}+      state: "on
-      - service: script.set_beacon2 +    - service: input_text.set_value 
-        data_template: +      data_template: 
-          ibeacon: "{{ ibeacon }}"+        entity_id: input_text.beacon2 
 +        value: "{{ ibeacon }}" 
 +    - service: input_boolean.turn_off 
 +      entity_id: input_boolean.beacon2_learn
  
-  set_beacon1+beacon2_active
-    sequence: +  sequence: 
-      servicescript.beacon1_active +    conditiontemplate 
-        data_template: +      value_template: "{{ ibeacon == states('input_text.beacon2'}}" 
-          ibeacon: "{{ ibeacon }}" +    service: input_boolean.turn_on 
-      condition: state +      entity_id: input_boolean.beacon2_trigger 
-        entity_id: input_boolean.beacon1 +    - delay1 
-        state: "on" +    - service: input_boolean.turn_off 
-      - service: input_text.set_value +      entity_id: input_boolean.beacon2_trigger
-        data_template: +
-          entity_id: input_text.beacon1 +
-          value"{{ ibeacon }}" +
-      - service: input_boolean.turn_off +
-        entity_id: input_boolean.beacon1+
  
-  set_beacon2: 
-    sequence: 
-      - service: script.beacon2_active 
-        data_template: 
-          ibeacon: "{{ ibeacon }}" 
-      - condition: state 
-        entity_id: input_boolean.beacon2 
-        state: "on" 
-      - service: input_text.set_value 
-        data_template: 
-          entity_id: input_text.beacon2 
-          value: "{{ ibeacon }}" 
-      - service: input_boolean.turn_off 
-        entity_id: input_boolean.beacon2 
  
-  beacon1_active: +</code>
-    sequence: +
-      - condition: template +
-        value_template: "{{ ibeacon == states('input_text.beacon1') }}" +
-      - service: input_boolean.turn_on +
-        entity_id: input_boolean.beacon1_active +
-      - delay: 30 +
-      - service: input_boolean.turn_off +
-        entity_id: input_boolean.beacon1_active+
  
-  beacon2_active: 
-    sequence: 
-      - condition: template 
-        value_template: "{{ ibeacon == states('input_text.beacon2') }}" 
-      - service: input_boolean.turn_on 
-        entity_id: input_boolean.beacon2_active 
-      - delay: 30 
-      - service: input_boolean.turn_off 
-        entity_id: input_boolean.beacon2_active 
  
                      
-           +hass automations: 
-automations: +<code> 
-  - alias: "beacon2 is active" +- alias: "beacon2 is active" 
-    trigger: +  trigger: 
-      platform: state+    platform: state 
 +    entity_id: input_sensor.beacon2_trigger 
 +    to: "on" 
 +  condition: 
 +    condition: state 
 +    entity_id: input_boolean.beacon2_active 
 +    state: "off" 
 +  action: 
 +    - service: input_boolean.turn_on
       entity_id: input_boolean.beacon2_active       entity_id: input_boolean.beacon2_active
-      to: "on" +    - service: notify.alexa_media 
-    action: +      data: 
-      - service: notify.alexa_media+        message: "Stefano è arrivato"
         data:         data:
-          message: "Stefano è arrivato" +          type: announce 
-          data: +          method: all 
-            type: announce +        target: 
-            method: all +          - show 
-          target: +          - Echo
-            - show +
-            - Echo+
  
-  - alias: "beacon2 is not active after last presence" +- alias: "beacon2 is not active after last presence" 
-    trigger: +  trigger: 
-      platform: state+    platform: state 
 +    entity_id: input_boolean.beacon2_trigger 
 +    to: "off" 
 +    for: 140 
 +  action: 
 +    - service: input_boolean.turn_off
       entity_id: input_boolean.beacon2_active       entity_id: input_boolean.beacon2_active
-      to"off" +    - servicenotify.alexa_media 
-      for+      data
-        minutes+        message"Stefano è partito"
-    action: +
-      - service: notify.alexa_media+
         data:         data:
-          message: "Stefano è partito" +          type: announce 
-          data: +          method: all
-            type: announce +
-            method: all +
-          target: +
-            - show +
-            - Echo +
- +
-  - alias: "beacon1 is active" +
-    trigger: +
-      platform: state +
-      entity_id: input_boolean.beacon1_active +
-      to: "on" +
-    action: +
-      - service: light.turn_on+
         target:         target:
-          entity_id: light.ikea_of_sweden_tradfri_bulb_e27_ws_opal_980lm_c969e5fe_level_light_color_on_off +          - show 
- +          Echo
- +
-  alias: "beacon1 is not active after last presence" +
-    trigger: +
-      platform: state +
-      entity_id: input_boolean.beacon1_active +
-      to: "off" +
-      for: +
-        minutes: 1 +
-    action: +
-      service: light.turn_off +
-        target: +
-          entity_id: light.ikea_of_sweden_tradfri_bulb_e27_ws_opal_980lm_c969e5fe_level_light_color_on_off +
 </code> </code>
  
Line 225: Line 344:
 type: entities type: entities
 entities: entities:
-  - entity: input_boolean.beacon1 +  - entity: input_boolean.beacon2_learn 
-  - entity: input_text.beacon1 +  - entity: input_text.beacon2 
-  - entity: sensor.wifi_signal_sensor +  - entity: input_boolean.beacon2_trigger 
-  - entity: input_boolean.beacon1_active +  - entity: input_boolean.beacon2_active 
-  - entity: >- +title: Tracker cancello
-      light.ikea_of_sweden_tradfri_bulb_e27_ws_opal_980lm_c969e5fe_level_light_color_on_off +
-title: Tracker soggiorno+
 </code> </code>
  
  • projects/internetofthings/esphome.1614316760.txt.gz
  • Last modified: 2021/02/26 06:19
  • by scipio