Hello the communuty,
Soory im noob
i try to synchronise state of the switch of domoticz. Here is my configuration
switch:
- platform: command_line
switches:
nom_test:
command_on: "/usr/bin/curl 'http://10.27.1.1:8855/json.htm?param=udevice&type=command&idx=115&nvalue=1'"
command_off: "/usr/bin/curl 'http://10.27.1.1:8855/json.htm?param=udevice&type=command&idx=115&nvalue=0'"
command_state: "/usr/bin/curl -X GET http://10.27.1.1:8855/json.htm?type=devices&rid=115"
value_template: '{{ value_json.result.Status }}'
friendly_name: test
```````````````````````````````````````````````````````````````
The result of my http comand_state :
```````````````````````````````````````````````````````````````
{
"ActTime" : 1595910719,
"AstrTwilightEnd" : "19:16",
"AstrTwilightStart" : "05:34",
"CivTwilightEnd" : "18:22",
"CivTwilightStart" : "06:28",
"DayLength" : "11:08",
"NautTwilightEnd" : "18:49",
"NautTwilightStart" : "06:01",
"ServerTime" : "2020-07-28 08:31:59",
"SunAtSouth" : "12:25",
"Sunrise" : "06:51",
"Sunset" : "17:59",
"app_version" : "2020.2",
"result" :
[
{
"AddjMulti" : 1.0,
"AddjMulti2" : 1.0,
"AddjValue" : 0.0,
"AddjValue2" : 0.0,
"BatteryLevel" : 255,
"CustomImage" : 0,
"Data" : "On",
"Description" : "",
"DimmerType" : "none",
"Favorite" : 0,
"HardwareID" : 3,
"HardwareName" : "Virtuel",
"HardwareType" : "Dummy (Does nothing, use for virtual switches only)",
"HardwareTypeVal" : 15,
"HaveDimmer" : false,
"HaveGroupCmd" : true,
"HaveTimeout" : false,
"ID" : "79",
"Image" : "Light",
"IsSubDevice" : false,
"LastUpdate" : "2020-07-24 15:14:34",
"Level" : 0,
"LevelInt" : 0,
"MaxDimLevel" : 0,
"Name" : "test",
"Notifications" : "false",
"PlanID" : "0",
"PlanIDs" :
[
0
],
"Protected" : false,
"ShowNotifications" : true,
"SignalLevel" : "-",
"Status" : "On", <-- Seem to be here a solution
"StrParam1" : "",
"StrParam2" : "",
"SubType" : "X10",
"SwitchType" : "On/Off",
"SwitchTypeVal" : 0,
"Timers" : "false",
"Type" : "Lighting 1",
"TypeImg" : "lightbulb",
"Unit" : 1,
"Used" : 1,
"UsedByCamera" : false,
"XOffset" : "0",
"YOffset" : "0",
"idx" : "115"
}
],
"status" : "OK",
"title" : "Devices"
}
`````````````````````````````````````````````````````````
The On off command work perfectly. My problem is when i change value on domoticz Home assitant is not sync.
Is there any solution to sync with json put on when statut is on and off when statut is off?
I have seen pooling option car i make a request every 5 minutes to sync?
Thx a lot :)