dathosim / HomeAssistant-Freebox-Pack-Securite

Configuration Home assistant pour Pack Sécurité de la Freebox Delta
GNU General Public License v3.0
19 stars 5 forks source link

Aide à la configuration #5

Open alexblav opened 2 years ago

alexblav commented 2 years ago

Bonjour et merci pour votre travail

J'ai un souci concernant la configuration, j'ai configuré l'alarme qui est vu comme inconnue, pour les détecteurs de mouvement, j'ai créé une entrée pour chacun d'eux avec un nom différent mais je n'arrive pas à les faire remonter. un remonte en inconnu et c'est tout

qu'est-ce que je peux avoir loupé?

Par avance merci

alexblav commented 2 years ago

Re,

En fouillant, j'ai trouvé ceci dans les logs de l'addon node-red:

20 Sep 12:11:15 - [info] Node-RED version: v3.0.2
20 Sep 12:11:15 - [info] Node.js  version: v16.16.0
20 Sep 12:11:15 - [info] Linux 5.15.61-v8 arm64 LE
20 Sep 12:11:17 - [info] Loading palette nodes
20 Sep 12:11:22 - [info] Dashboard version 3.2.0 started at /endpoint/ui
20 Sep 12:11:23 - [info] Settings file  : /etc/node-red/config.js
20 Sep 12:11:23 - [info] Context store  : 'default' [module=memory]
20 Sep 12:11:23 - [info] User directory : /config/node-red/
20 Sep 12:11:23 - [warn] Projects disabled : editorTheme.projects.enabled=false
20 Sep 12:11:23 - [info] Flows file     : /config/node-red/flows.json
20 Sep 12:11:23 - [info] Server now running at http://127.0.0.1:46836/
20 Sep 12:11:23 - [info] Starting flows
[12:11:23] INFO: Starting NGinx...
20 Sep 12:11:23 - [info] Connecting to freebox at https://192.168.0.254:443
20 Sep 12:11:23 - [info] Started flows
20 Sep 12:11:23 - [info] [mqtt-broker:HA-MQTT] Connected to broker: mqtt://192.168.0.36:1883
20 Sep 12:11:23 - [info] Application registered
20 Sep 12:11:28 - [info] [server:Home Assistant] Connecting to http://supervisor/core
20 Sep 12:11:28 - [info] [server:Home Assistant] Connected to http://supervisor/core
20 Sep 12:11:28 - [info] GET /home/tileset/all
20 Sep 12:11:28 - [info] Session opened
20 Sep 12:11:28 - [error] get https://192.168.0.254:443/api/v9/home/tileset/all
20 Sep 12:11:28 - [red] Uncaught Exception:
20 Sep 12:11:28 - [error] Error: Unhandled error. (undefined)
    at new NodeError (node:internal/errors:372:5)
    at EventEmitter.emit (node:events:516:17)
    at /config/node-red/node_modules/node-red-contrib-freebox/src/nodes/freebox-server/freebox-server.js:257:31
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
[12:11:29] WARNING: Node-RED crashed, halting add-on
s6-rc: info: service legacy-services: stopping
[12:11:29] INFO: Node-RED stopped, restarting...
[12:11:29] INFO: Node-RED stopped, restarting...
s6-svwait: fatal: supervisor died
s6-rc: info: service legacy-services successfully stopped
s6-rc: info: service legacy-cont-init: stopping
s6-rc: info: service legacy-cont-init successfully stopped
s6-rc: info: service fix-attrs: stopping
s6-rc: info: service fix-attrs successfully stopped
s6-rc: info: service s6rc-oneshot-runner: stopping
s6-rc: info: service s6rc-oneshot-runner successfully stopped

j'ai restauré la sauvegarde et Nodered est reparti

Pour autant, je n'arrive pas à faire remonter tout mes capteurs

alexblav commented 2 years ago

Je viens de tenter de réduire ma configuration à ceci:

sensor:
  - platform: mqtt
    name: "Alarme"
    unique_id: "sensor.freebox_alarme"
    icon: 'mdi:alarm-light'
    state_topic: "node_red/freebox_home_tileset_all"
    value_template: >-
        {% for x in value_json %}
        {% if  x.type == "alarm_control"  %}
        {% if x.data[0].value == 'idle' %}
        D..sactiv..e
        {% elif x.data[0].value == 'alarm1_armed' %}
        Alarme principale activ..e
        {% elif x.data[0].value == 'alarm1_arming' %}
        Alarme principale en cours d'activation
        {% elif x.data[0].value == 'alarm2_armed' %}
        Alarme secondaire activ..e
        {% elif x.data[0].value == 'alarm2_arming' %}
        Alarme secondaire en cours d'activation
        {% else %}
        Inconnu
        {% endif %}
        {% endif %}
        {% endfor %}

  - platform: mqtt
    # Si vous avez plusieurs d..tecteurs, il faut ajouter `and x.label == "<nom donn.. au d..tecteur dans l'application Freebox"` apr..s ` if  x.type == "alarm_sensor"`.
    name: "Alarme - Porte exterieur statut"
    unique_id: "sensor.freebox_detecteur_ouverture"
    icon: 'mdi:door-open'
    state_topic: "node_red/freebox_home_tileset_all"
    payload_available: "online"
    payload_not_available: "offline"
    value_template: >-
        {% for x in value_json %}
        {% if  x.type == "alarm_sensor" and x.label == "Porte exterieur" and x.icon_url == "/resources/images/home/pictos/detecteur_ouverture.png" %}
        {% if x.data[0].value == True %}
        Ferm..e
        {% elif x.data[0].value == False %}
        Ouverte
        {% else %}
        Inconnu
        {% endif %}
        {% endif %}
        {% endfor %}
  - platform: mqtt
    # Si vous avez plusieurs d..tecteurs, il faut ajouter `and x.label == "<nom donn.. au d..tecteur dans l'application Freebox"` apr..s ` if  x.type == "alarm_sensor"`.
    name: "Alarme - Porte exterieur Couvercle"
    unique_id: "sensor.freebox_detecteur_ouverture_couvercle"
    icon: 'mdi:valve-open'
    state_topic: "node_red/freebox_home_tileset_all"
    payload_available: "online"
    payload_not_available: "offline"
    value_template: >-
        {% for x in value_json %}
        {% if  x.type == "alarm_sensor" and x.label == "Porte exterieur" and x.icon_url == "/resources/images/home/pictos/detecteur_ouverture.png" %}
        {% if x.data[1].value == False %}
        Couvercle ferm..
        {% elif x.data[1].value == True %}
        Couvercle ouvert
        {% else %}
        Inconnu
        {% endif %}
        {% endif %}
        {% endfor %}
  - platform: mqtt
    # Si vous avez plusieurs d..tecteurs, il faut ajouter `and x.label == "<nom donn.. au d..tecteur dans l'application Freebox"` apr..s ` if  x.type == "alarm_sensor"`.
    name: "Alarme - Porte exterieur Batterie"
    unique_id: "sensor.freebox_detecteur_ouverture_batterie"
    icon: 'mdi:battery'
    state_topic: "node_red/freebox_home_tileset_all"
    payload_available: "online"
    payload_not_available: "offline"
    value_template: >-
        {% for x in value_json %}
        {% if  x.type == "alarm_sensor" and x.label == "Porte exterieur" and x.icon_url == "/resources/images/home/pictos/detecteur_ouverture.png" %}
        {{ x.data[2].value }}%
        {% endif %}
        {% endfor %}

  - platform: mqtt
    # Si vous avez plusieurs d..tecteurs, il faut ajouter `and x.label == "<nom donn.. au d..tecteur dans l'application Freebox"` apr..s ` if  x.type == "alarm_sensor"`.
    name: "Alarme - Fenetre Parents statut"
    unique_id: "sensor.freebox_detecteur_ouverture"
    icon: 'mdi:door-open'
    state_topic: "node_red/freebox_home_tileset_all"
    payload_available: "online"
    payload_not_available: "offline"
    value_template: >-
        {% for x in value_json %}
        {% if  x.type == "alarm_sensor" and x.label == "Fenetre Parents" and x.icon_url == "/resources/images/home/pictos/detecteur_ouverture.png" %}
        {% if x.data[0].value == True %}
        Ferm..e
        {% elif x.data[0].value == False %}
        Ouverte
        {% else %}
        Inconnu
        {% endif %}
        {% endif %}
        {% endfor %}
  - platform: mqtt
    # Si vous avez plusieurs d..tecteurs, il faut ajouter `and x.label == "<nom donn.. au d..tecteur dans l'application Freebox"` apr..s ` if  x.type == "alarm_sensor"`.
    name: "Alarme - Fenetre Parents Couvercle"
    unique_id: "sensor.freebox_detecteur_ouverture_couvercle"
    icon: 'mdi:valve-open'
    state_topic: "node_red/freebox_home_tileset_all"
    payload_available: "online"
    payload_not_available: "offline"
    value_template: >-
        {% for x in value_json %}
        {% if  x.type == "alarm_sensor" and x.label == "Fenetre Parents" and x.icon_url == "/resources/images/home/pictos/detecteur_ouverture.png" %}
        {% if x.data[1].value == False %}
        Couvercle ferm..
        {% elif x.data[1].value == True %}
        Couvercle ouvert
        {% else %}
        Inconnu
        {% endif %}
        {% endif %}
        {% endfor %}
  - platform: mqtt
    # Si vous avez plusieurs d..tecteurs, il faut ajouter `and x.label == "<nom donn.. au d..tecteur dans l'application Freebox"` apr..s ` if  x.type == "alarm_sensor"`.
    name: "Alarme - Fenetre Parents Batterie"
    unique_id: "sensor.freebox_detecteur_ouverture_batterie"
    icon: 'mdi:battery'
    state_topic: "node_red/freebox_home_tileset_all"
    payload_available: "online"
    payload_not_available: "offline"
    value_template: >-
        {% for x in value_json %}
        {% if  x.type == "alarm_sensor" and x.label == "Fenetre Parents" and x.icon_url == "/resources/images/home/pictos/detecteur_ouverture.png" %}
        {{ x.data[2].value }}%
        {% endif %}
        {% endfor %}

Quand je rafraichi, j'obtiens Alarme, Porte exterieur mais pas Fenetre Parents. Par ailleurs, les entités récupérées semblent rester à l'état inconnu. Si vous n'avez pas le temps ce que je peux comprendre, pouvez-vous me dire comment, dans nodered, voir le contenu du json. Sa structure a peut-être changé en 1 an.

Encore merci