Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Erreur Invalid config for [mqtt]: expected dictionar #4

Open
moi-001 opened this issue Jul 17, 2022 · 2 comments
Open

Erreur Invalid config for [mqtt]: expected dictionar #4

moi-001 opened this issue Jul 17, 2022 · 2 comments

Comments

@moi-001
Copy link

moi-001 commented Jul 17, 2022

Bonjour,

jai suivi les instructions mais il semblerai que j'ai oublié quelque chose
jai l'erreur suivante :
jai bien une box delta avec le pack alarm actif
jai bien installer Broker MQTT
jai bien installer Node-RED
jai bien installer node-red-contrib-freebox
jai bien sur note red les voyants vert pour api-node et pour freebox_home_tilleset_all vert et fait un deploy (en rouge)
jai bien valider aceptation sur la box autosiser les accès sur FreeboxOS
jai bien ajouter les données dans configuration.yaml

mais je n'ai pas le sensor sensor.freebox_alarme
et j'ai le message d'erreur suivant
ou est mon erreur


Invalid config for [mqtt]: expected dictionary for dictionary value @ data['mqtt']. Got [OrderedDict([('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 =.... (See /config/configuration.yaml, line 190).


merci de votre aide

@dathosim
Copy link
Owner

Je n'utilise plus cette intégration mais il me semble que unique_id ne soit plus autorisé
Peut-être faut il essayer en supprimant cette ligne tout simplement
Le sensor portera le nom de la valeur de "name" mais en snake case

@d3m10n
Copy link

d3m10n commented Dec 17, 2022

edit:
@dathosim bon boulot ! Ca marche tres bien, testé 12/2022 . Dommage que c'est abandonné

@moi-001
unique ID is valid

you have to respect new syntax.
https://www.home-assistant.io/integrations/sensor.mqtt/

E.g. for a motion detector

    - state_topic: "node_red/freebox_home_tileset_all"
    # 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: "Détecteur de mouvement"
      unique_id: "sensor.freebox_detecteur_mouvement"
      icon: 'mdi:motion-sensor'
      payload_available: "online"
      payload_not_available: "offline"
      value_template: >-
        {% for x in value_json %}
        {% if  x.type == "alarm_sensor" and x.icon_url == "/resources/images/home/pictos/detecteur_mouvement.png" %}
        {% if x.data[0].value == True %}
        Aucun mouvement
        {% elif x.data[0].value == False %}
        Mouvement détecté
        {% else %}
        Inconnu
        {% endif %}
        {% endif %}
        {% endfor %}
    - state_topic: "node_red/freebox_home_tileset_all"
    # 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: "Détecteur de mouvement Couvercle"
      unique_id: "sensor.freebox_detecteur_mouvement_couvercle"
      icon: 'mdi:valve-open'
      payload_available: "online"
      payload_not_available: "offline"
      value_template: >-
        {% for x in value_json %}
        {% if  x.type == "alarm_sensor" and x.icon_url == "/resources/images/home/pictos/detecteur_mouvement.png" %}
        {% if x.data[1].value == False %}
        Couvercle fermé
        {% elif x.data[1].value == True %}
        Couvercle ouvert
        {% else %}
        Inconnu
        {% endif %}
        {% endif %}
        {% endfor %}
    - state_topic: "node_red/freebox_home_tileset_all"
    # 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"`. 
    # Pas sur de la formule pour calculer le % de batterie... La valeur n'a pas l'air d'être récupérée automatiquement si > 10%.
      name: "Détecteur de mouvement Batterie"
      unique_id: "sensor.freebox_detecteur_mouvement_batterie"
      icon: 'mdi:battery'
      payload_available: "online"
      payload_not_available: "offline"
      value_template: >-
        {% for x in value_json %}
        {% if  x.type == "alarm_sensor" and x.icon_url == "/resources/images/home/pictos/detecteur_mouvement.png" %}
        {% if x.data[2].value == None %}
        100%
        {% else %}
        {{ x.data[2].value }}%
        {% endif %}
        {% endif %}
        {% endfor %}`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants