Domoticz plugin

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
akamming
New user
Posts: 3
Joined: 25 Mar 2021, 07:11

Domoticz plugin

#1 Post by akamming » 25 Mar 2021, 07:35

Hi

I am new to ESP and so also to ESP Easy. just made my 1st project. Very happy with ESP Easy. ESP became indeed very easy! Compliments to all devs creating this peace of software!

I did find out there are a lot of manual steps for domoticz integration, so to make integration with domoticz easier, i am thinking of creating a python plugin for domoticz.

So now in order to readout in sensor in domoticz i have to do a lot of manual steps:
1 configure the domoticz controller in ESP Easy
2 configure the sensors as devices in ESP Easy
3 create virtual devices for every sensor in domoticz and configure the idx number in it and enable messages to be sent tot the controller for that device
4 if i want to control gpio: create virtual switches for every gpio and assign http commands to on and off states

So what i'm thinking of is creating a python plugin, so the flow would become
1. Configure the sensors in ESP Easy
2. Configure the python plugin in domoticz with IP Adress of the ESP device with ESP Easy
3. And then the python plugin would do the rest
- retrieve all sensors from the ESP device
- configure the ip adress, username and password of domoticz in the controller of espeasy
- create devices in domoticz for every configured devices in ESP Easy
- set the correct idx and enable "send to controller"
- create switches for every unused gpio in the espeasy (and handle the on/off events)


this would not be very difficult, except for that i am lacking some knowledge on which commands to use on the ESP, so who can help me with the following commands which i could not find in the documentation (or knows a way to work around it if these commands are not available)?
- the http command to configure a controller
- the http command to set an idx for a device (and enable "send to controller")

Tx

TD-er
Core team member
Posts: 8729
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Domoticz plugin

#2 Post by TD-er » 25 Mar 2021, 09:13

You can use the 'inspect' window of your browser to see what gets submitted when you configure a task.
This submit is a HTTP POST request, which you could 'replay' from Python.
The only sad part here is that as of now almost all plugin uses its own form parameter names and only a handful of the parameters is shared (e.g. the first 3 pin configurations and which controller is used etc.)
Among the standard shared parameters is the IDX field, so that's for sure one thing that can be shared in your code for all plugins.

Maybe you can also have a look at the code made for autodiscovery using Homie and I think there is also some ongoing work for other platforms like HomeAssistant.

akamming
New user
Posts: 3
Joined: 25 Mar 2021, 07:11

Re: Domoticz plugin

#3 Post by akamming » 25 Mar 2021, 13:55

TD-er wrote: 25 Mar 2021, 09:13 You can use the 'inspect' window of your browser to see what gets submitted when you configure a task.
This submit is a HTTP POST request, which you could 'replay' from Python.
The only sad part here is that as of now almost all plugin uses its own form parameter names and only a handful of the parameters is shared (e.g. the first 3 pin configurations and which controller is used etc.)
Among the standard shared parameters is the IDX field, so that's for sure one thing that can be shared in your code for all plugins.

Maybe you can also have a look at the code made for autodiscovery using Homie and I think there is also some ongoing work for other platforms like HomeAssistant.
tx i understand what you are saying, already checked. The pages are forms using post requests. So to simulate that would be very tricky, and also require a lot of maintenance in case of new espeasy releases. I was hoping there are commands available to do this.

e.g. i see a "config" command at this page https://www.letscontrolit.com/wiki/inde ... _Reference, but it's undocumented, so looking for more info like that...

TD-er
Core team member
Posts: 8729
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Domoticz plugin

#4 Post by TD-er » 25 Mar 2021, 14:15

That's something that we will be using/implementing when migrating the web UI from the current one to a JavaScript SPA version which is in development.
Then working with settings will be more like a REST interface.
The ESP will then generate a JSON structure which will be a more standardized form and the submits will be filled in JSON structures being sent via POST.

akamming
New user
Posts: 3
Joined: 25 Mar 2021, 07:11

Re: Domoticz plugin

#5 Post by akamming » 26 Mar 2021, 15:59

TD-er wrote: 25 Mar 2021, 14:15 That's something that we will be using/implementing when migrating the web UI from the current one to a JavaScript SPA version which is in development.
Then working with settings will be more like a REST interface.
The ESP will then generate a JSON structure which will be a more standardized form and the submits will be filled in JSON structures being sent via POST.
ok tx, i will await that development...

Post Reply

Who is online

Users browsing this forum: No registered users and 14 guests