X10 Community Forum

💬General Category => Mac/Linux & Open Source and the X10 Home => Raspberry Pi, Arduino & other SBC => Topic started by: mike on October 03, 2018, 06:45:41 PM

Title: How to write URL for browser to turn on A1 via Mochad in domoticz?
Post by: mike on October 03, 2018, 06:45:41 PM
Mike I don't use Domoticz but here's a typical example of operating a device using a URL directly from the browser address bar. You should be able to figure the exact syntax yourself.

Try starting a new post as my original post is gone out of shape now.


Title: Re: How to write URL for browser to turn on A1 via Mochad in domoticz?
Post by: petera on October 03, 2018, 06:59:46 PM
@mike I left the link off that last post https://www.domoticz.com/forum/viewtopic.php?t=20684
Title: Re: How to write URL for browser to turn on A1 via Mochad in domoticz?
Post by: petera on October 03, 2018, 07:09:54 PM
If you intend staying with Domoticz and want to get the most out of it might be worth getting familiar with dzVents. All explained here https://www.domoticz.com/wiki/DzVents:_next_generation_LUA_scripting
Title: Re: How to write URL for browser to turn on A1 via Mochad in domoticz?
Post by: mike on October 03, 2018, 07:23:44 PM
Thanks!   I too found api discription for domoticz:      https://www.domoticz.com/wiki/Domoticz_API/JSON_URL%27s

Seems with all this info I should be able to get control via urls, which then leads to using HA-bridge to talk to my RM Broadlink.
Title: Re: How to write URL for browser to turn on A1 via Mochad in domoticz?
Post by: mike on October 03, 2018, 07:35:59 PM
http://192.168.0.16:8080/json.htm?type=command&param=switchlight&idx=3&switchcmd=On

shows up in domoticz lite log but does not turn it on/off....  getting close!
Title: Re: How to write URL for browser to turn on A1 via Mochad in domoticz?
Post by: mike on October 03, 2018, 07:50:54 PM
https://www.domoticz.com/wiki/Domoticz_API/JSON_URL%27s

Domoticz allows you to interact with all your switches and sensors using JSON, either interactively through a browser or programmatically from a scripting language. In fact, when you interact with the Domoticz UI through your browser by clicking on buttons and such, under the hood it's JSON that actually communicates your changes back to the Domoticz engine (Hint: You can watch this behaviour at any time by enabling developer tools in your browser and watching the network tab's traffic when you change something through the UI). This wiki describes how to use this versatile API.

wow!   shows show domoticz natively turns stuff on and off in that tools at bottom of the screen!   
Title: Re: How to write URL for browser to turn on A1 via Mochad in domoticz?
Post by: mike on October 03, 2018, 07:55:13 PM
http://192.168.0.16:8080/json.htm?type=command&param=switchlight&idx=3&switchcmd=On

shows up in domoticz lite log but does not turn it on/off....  getting close!

not sure why domoticz stopped turning lites on and off;  had to SSH into it and sudo reboot.  Now it works and so does:

http://192.168.0.16:8080/json.htm?type=command&param=switchlight&idx=3&switchcmd=On

Thanks to everyone pointing me in the right direction;  I had no idea what I was looking for called an API.
Title: Re: How to write URL for browser to turn on A1 via Mochad in domoticz?
Post by: Tuicemen on October 03, 2018, 07:59:03 PM
Ha-Bridge has a helper for domoticz which auto detects all your configured devices I believe it fills in the on/off calls as well though not looked into it.
Title: Re: How to write URL for browser to turn on A1 via Mochad in domoticz?
Post by: mike on October 03, 2018, 08:16:51 PM
Ha-Bridge has a helper for domoticz which auto detects all your configured devices I believe it fills in the on/off calls as well though not looked into it.

WOW!!

DOUBLE WOW!!

So my simple automation desires are starting to come to fruition! 

- I have sent my wife a URL icon named "rest modem" that works - she can drag it from her email to her apple desktop!
- I can turn on/off any device via web url now
- with the HA-bridge build I will again have security device transmission to auto arm/disarm my security system.  I will be able to replace the old XP computer at my office across town with one of these little ittsy bittsy pi's and not have to teamview into it to make changes
- the blockly graphical if then else, timers, etc, can replace  my AHP macros
- I can retire the AHPs running at different locations and finally get with the '90's!
Title: Re: How to write URL for browser to turn on A1 via Mochad in domoticz?
Post by: petera on October 04, 2018, 07:40:50 AM
Ha-Bridge has a helper for domoticz which auto detects all your configured devices I believe it fills in the on/off calls as well though not looked into it.

WOW!!

DOUBLE WOW!!

So my simple automation desires are starting to come to fruition! 

- I have sent my wife a URL icon named "rest modem" that works - she can drag it from her email to her apple desktop!
- I can turn on/off any device via web url now
- with the HA-bridge build I will again have security device transmission to auto arm/disarm my security system.  I will be able to replace the old XP computer at my office across town with one of these little ittsy bittsy pi's and not have to teamview into it to make changes
- the blockly graphical if then else, timers, etc, can replace  my AHP macros
- I can retire the AHPs running at different locations and finally get with the '90's!

You can see how powerful JSON is when it comes to all things web control. Definitely worth a further dig around.

I pointed you to DzVents which will allow you to control all your Domoticz events. Events as you know are the backbone of home automation. You can turn on a light with a remote control. Events on the other hand will determine the when, how and why it's being turned on in the first place.

I would have stayed with Domoticz but for the lack of support for a particular security panel I use.

I do suggest to anyone choosing a platform to firstly examine what technologies they want to use on it and if they are actually supported "out of the box"