This text could be a little bit longer ... Sorry for that
Yesterday I started to take a look at EspEasy again. I was using it 4 years ago and at that time I wrote the candle plugin for EspEasy.
My goal was to include some of my switchable power plugs into my home automatisation ioBroker.
So I started to compile my own EspEasy. I know I can use prebuild binaries but I like it to compile and optimize thing for my needs.
It was no problem to flash my new gosund SP211 dual plug with EspEasy but then the reverse engineering starts ...
There is a good Tasmota page to find out the pins you have to use: https://templates.blakadder.com/gosund_SP211.html
So that was my base.
I started configuring the Hardware tab with the pins. Then over to the next Tab and configure the Devices. Next was to enable rules when you need to switch with the hardware button from the SP211.
Then you have to write a rule for switching the relais and the leds. And at the end you have to setup any MQTT controller.
I use the "Home Assistant (openHAB) MQTT" controller but I discoverd very quickly that you have to use different MQTT topics for
- swiching the relais over GPIOs
- get the state of the Relais / switch
So this is a lot of work to do. And I think a beginner could easily struggle with all the settings. Coming from Tasmota it is very easy to setup such a switchable plug.
Just select a template, configure the MQTT client and you are almost done ...
So I have some changes in mind and just want to know what you guys thinking about that ...
1) Add a new device like "Input to Output"
It would be nice to have one Device where you can configure an Input and associate 2 or 3 outputs.
So basically you have 3 or 4 comboboxes. In the first you select your input pin - which is in most cases the hardware switch.
And in the rest boxes you select output pins for relais, Led, ...
If you push the button you toggle the associated outputs.
You don´t need any rules, you can see the realations between in and out and I think it´s easy to understand and easy to implement
@TD-er
I would love to develope this plugin. Did you see any problems I should take care about?
So would it be conflict with the internal GPIO handling if I set output pins in my plugin?
2) Add a new Controller to handle the SonOff adapter in ioBroker
The second thing I really miss is a controller to handle the SonOff Adapter in iobroker. It´s basically a MQTT broker which needs some JSON as input.
Here are some example topics:
Code: Select all
tele/sonoff/SENSOR
{"Time":"2020-09-26T14:10:35","ENERGY":{"TotalStartTime":"2019-11-16T11:49:54","Total":7.141,"Yesterday":0.000,"Today":0.000,"Period":0,"Power":0,"ApparentPower":0,"ReactivePower":0,"Factor":0.00,"Voltage":0,"Current":0.000}}
tele/sonoff/STATE
{"Time":"2020-09-26T14:11:16","Uptime":"7T08:18:19","UptimeSec":634699,"Heap":28,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"MqttCount":10,"POWER":"OFF","Wifi":{"AP":1,"SSId":"NoMamsLand","BSSId":"3C:A6:2F:0F:63:58","Channel":6,"RSSI":48,"LinkCount":5,"Downtime":"0T00:04:26"}}
In iobroker you see devices with SonOff like this:
And the best is yet to come ... Changing the Power item (marked yellow) directly switches the device over MQTT messages.
This is extreamly useful because you can use it for controlling and state view in one item.
So writing a Controller for EspEasy which could speak the SonOff Adapter format and is able to control devices directly over the mqtt topics would be really nice.
I think I could do this too - maybe with a little help from the devs ...
3) Putting it all together ...
So if there is a new Plugin and a new controller there is one question left. It´s more a technical or developement driven question ...
How can a controller in EspEasy inform a device / plugin that there is a new MQTT message?
If you change the POWER topic within the SonOff adapter you get a response like this:
Code: Select all
tele/sonoff/POWERON
Code: Select all
stat/sonoff/RESULT
{"POWER":"ON"}
would be nice to get a little hint for this topic.
Let´s come to an end with this long message
First of all ... What to you think about my suggestions?
And secondly ... Did you see any show stopper for these topics? Anything which couldn´t or shouldn´t implement within EspEasy ?
For me it would be a challange and some fun to do the developing.
And at the end it could be easier to setup and use power plugs (not only) with ioBroker - hopefully
Have a nice sunday ...
Dominik