Hello, I am French and I am a newbie, I will try to get an answer on this forum because on the French hacf forum, no one has been able to give me any information. Maybe I’ll have better luck here. I would like to have the two Jeedom and Home assistant systems coexist and
I would like to retrieve the status of a zwave connected socket under jeedom in home assistant. For this I use jMQTT to send the status of my socket. MQTT Explorer shows me a 1 or a 0 depending on the state of the socket when I activate it under jeedom. Under home assistant, I create a mqtt sensor in this form:
the sensor updates well in home assistant. I created a switch under home assistant which allows me with curl to control my socket under jeedom. As long as I stay under home assistant, the switch reacts normally and changes state according to my clicks.
The problem is when I activate the socket from jeedom and turn it on for example, mqtt sends the value 1 but the switch under home assistant does not change while my sensor.etat_noeud25 goes to 1.
This is how I declared the switch:
- platform: command_line
switches:
noeud25:
value_template: "{{ is_state('sensor.etat_noeud25', '1') }}"
command_on: /usr/bin/curl -X GET "https://IP/core/api/jeeApi.php?apikey=API&type=cmd&id=7120" #commande pour ouvrir
command_off: /usr/bin/curl -X GET "https://IP/core/api/jeeApi.php?apikey=API&type=cmd&id=7121"
I have the impression that it comes from the value_template but I am not familiar enough with yaml. Has anyone faced this issue before and is there a solution? Thanks in advance to anyone who can answer me.
String is not a Boolean. Thant could explain everything.
value_template string (optional)
If specified, command_state will ignore the result code of the command but the template evaluating to true will indicate the switch is on.
You can substitue
{{ states('sensor.noeud25') | int == 1 }}
Or put on 2 lines, to get rid of the double quotes
I think I’ve had issues with value_templates like that. Putting it on a separate line may work but you can also specify the true value in the template as well: