Domoticz API / JSON integration/configuration

Currently I have 2 home automation systems :
1 = Domoticz which is my primary system for 4 years with Razberry and RFXcom radio P1 and even MQTT icw SonOff.
2 = Home Assistant (which I like a lot, especially the tracking component)

I have setup Home assistant, but I would like to keep Domoticz as well (for now). So I thought why can’t I add switches in Home Assitant and trigger a JSON call. I can switch my lights in Domoticz
On: /json.htm?type=command&param=switchlight&idx=99&switchcmd=On
Off: /json.htm?type=command&param=switchlight&idx=99&switchcmd=Off

See also http://domoticz.com/wiki/Domoticz_API/JSON_URL's

What would be the best way to do this in Home Assistant? Or would it even be possible to create a complete integration with MQTT?

Could this do the trick?

Manny thanks! It works, see below an example.

switch:
  - platform: command_line
    switches:
      tv_light:
        command_on: 'curl "http://domoticz_ip:8080/json.htm?type=command&param=switchlight&idx=49&switchcmd=On"'
        command_off: 'curl "http://domoticz_ip:8080/json.htm?type=command&param=switchlight&idx=49&switchcmd=Off"'

The response when the JSON call is made via the Chrome browser gives me the below response, should I put that somewhere in the HASS configuration or can that be ignored?

{
   "status" : "OK",
   "title" : "SwitchLight"
}

The only thing which is missing now, is that the both platforms might be out off sync.

When I do a call like:
http://domoticz_ip:8080/json.htm?type=devices&filter=all&used=true&order=Name

I will get a list with all devices and there actual status. Can this be imported or synchronised?

1 Like

@mlamie I’m interested to know if you managed to get your Domoticz integration working.

Did you manage to get your devices statuses in sync?

I can control, but there is no sync. If anyone can make it work it would be great.

I know it’s possible, but i’m not good at scripting, should be something like:

command_state: “/usr/bin/curl -X GET http://192.168.1.10/digital/4
value_template: ‘{{ value == “OK” }}’

as described in the manual

and maybe use a specfic device url to get the status
When I do a call like:
http://domoticz_ip:8080/json.htm?type=devices&filter=all&used=true&order=Name

I would also like to know how to do this, I have a couple of Domoticz ‘slaves’ around the house that I would like to control via HASS.IO.

They are Pi’s where I use the GPIO to control stuff.

If this could be done, I would be very very happy!

Anyone know how to do it?

Is there a way to update shutter status?command_state?value_template?