ESP more easy - for Domoticz

Moderators: rtenklooster, Voyager, BertB, Stuntteam

Forum rules
You have entered the experimental forum, beware!!!
Post Reply
Message
Author
martinus
Normal user
Posts: 129
Joined: 15 Feb 2020, 16:57

ESP more easy - for Domoticz

#1 Post by martinus » 15 Apr 2020, 18:04

Back to the original plan i've spend a few hours to prototype a plugin that will prevent mainly newbies to forget to enter the IDX value on a task :oops:

To make things easier, ESPEasy could create a Domoticz virtual sensor and a task for you so at least the basics will be present. In a way, i think that having some sort of wizards build into ESPEasy could help people getting started. So not a full featured mechanism, but it could show how it should be done and maybe offer a better OOTB experience.

It's built as a plugin itself, although this would likely better be designed as part of the controller (?).

Currently just a small proof of concept:
Wizard1.png
Wizard1.png (37.22 KiB) Viewed 25200 times
For convencience it will show the existing list of similar devices already present.
Then you can select the "Create new" tickbox and hit the submit button.

In a flash, it will create the virtual sensor on Domoticz and create a new task on ESPEasy as well.
Wizard2.png
Wizard2.png (44.83 KiB) Viewed 25200 times
What's missing is the device specifics, like getting a valid Dallas ID and such, but this would mean some smart sort of interaction between existing plugins to make this work. For an SI7021 it should be easier...

The plugin makes use of the Domoticz HTTP api that offers quite a lot of features besides pushing sensor data.

martinus
Normal user
Posts: 129
Joined: 15 Feb 2020, 16:57

Re: ESP more easy - for Domoticz

#2 Post by martinus » 15 Apr 2020, 19:47

For the SI7021 sensor, things were not so difficult because this module does not need specific settings:

Wizard3.png
Wizard3.png (50.85 KiB) Viewed 25193 times

Task auto-created in ESPEasy:

Wizard5.png
Wizard5.png (12.08 KiB) Viewed 25193 times

And in Domoticz, no action required, device pops-up automatically:

Wizard4.png
Wizard4.png (20.54 KiB) Viewed 25193 times

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

Re: ESP more easy - for Domoticz

#3 Post by TD-er » 15 Apr 2020, 22:44

Hmm that looks really nice.
And I am not entirely sure whether it should be a controller or something else.

I guess a new "wizard" thing that uses a controller and creates a plugin is probably more like it.

I am very interested in the code you used to do it.
I assume it uses Domoticz HTTP calls? Or does it also work with MQTT?

martinus
Normal user
Posts: 129
Joined: 15 Feb 2020, 16:57

Re: ESP more easy - for Domoticz

#4 Post by martinus » 16 Apr 2020, 11:27

TD-er wrote: 15 Apr 2020, 22:44 I assume it uses Domoticz HTTP calls? Or does it also work with MQTT?
I'm using the Domoticz JSON HTTP API for this stuff.

About the code? As short while ago, i found this plugin when i was looking for Philips Hue support on the forum.
https://www.letscontrolit.com/forum/vie ... 07&p=32142
I have a few bulbs and they are connected to Domoticz. But i'm exploring this plugin for direct communication from ESP Easy to the Hue bridge that also uses JSON format. I've noticed that the plugin uses a custom 'live' parsing of json while reading the web reply. I could use this for processing the Domoticz JSON API results while reading the webclient socket. (the returning json is likely to large to handle in a buffer as a whole)

But maybe there are better/smarter ways to parse and filter json while reading the webclient socket without using a large buffer? In cases like this, you only need one or two fields from every node.

Current code is only a Q&D prototype to see if stuff like this can be done (feasibility study)
Using API's like this:

Code: Select all

/json.htm?type=devices&filter=light&used=true&order=Name
/json.htm?type=createvirtualsensor&idx=5&sensorname=TempHum&sensortype=82
This also means that we can only do what the API supports, and i don't know what can be done for controllers besides Domoticz.
The "Homie MQTT convention" could be a universal way but some implementations that i saw haven't been touched for a year or several years.
I does not look like many projects have shown a real interest in Homie convention.

Post Reply

Who is online

Users browsing this forum: No registered users and 9 guests