Seting variable on dummy device from Homey
Moderators: grovkillen, Stuntteam, TD-er
Seting variable on dummy device from Homey
Hello everyone,
I just ordered a couple of LCD1602 I2C displays from Aliexpress with the intention of showing local sensor data in a custom-printed case with a Lolin S2 Mini.
I am using a Homey as the heart of my home automation and getting data into Homey from ESPEasy is quite simple with the ESPEasy app for Homey. My question is based on that It would be nice to show remote Homey data in the display, as well. However, I can't find much information when searching for how to send data back to the ESP from Homey.
Does anyone have any experience with this?
I read that there might be one option via MQTT and possibly one via HTTP requests from the ESP but what is the solution with as little increase as possible of the amount of grey hair?
I just ordered a couple of LCD1602 I2C displays from Aliexpress with the intention of showing local sensor data in a custom-printed case with a Lolin S2 Mini.
I am using a Homey as the heart of my home automation and getting data into Homey from ESPEasy is quite simple with the ESPEasy app for Homey. My question is based on that It would be nice to show remote Homey data in the display, as well. However, I can't find much information when searching for how to send data back to the ESP from Homey.
Does anyone have any experience with this?
I read that there might be one option via MQTT and possibly one via HTTP requests from the ESP but what is the solution with as little increase as possible of the amount of grey hair?
Re: Seting variable on dummy device from Homey
I don't know what Homey can do regarding making HTTP calls or sending data to some topics via MQTT.
I think sending data to some MQTT topics is by far the most elegant way as you don't need to construct specific URLs to be called to show some text on the display on ESPEasy.
Then you can use MQTT Import in ESPEasy to read those values from the MQTT topics and show them on the display.
I think sending data to some MQTT topics is by far the most elegant way as you don't need to construct specific URLs to be called to show some text on the display on ESPEasy.
Then you can use MQTT Import in ESPEasy to read those values from the MQTT topics and show them on the display.
Re: Seting variable on dummy device from Homey
Homey can easily make outgoing HTTP calls with sensor data as query string parameters. Inbound calls to extract sensor data seem to be a bit more tricky.
Regarding MQTT, there are packages for installing a local server and a client on Homey but I currently don't have those installed.
So, If I install those components and configure MQTT-Import devices in ESPEasy, the MQTT data would be available as variables that I can show on the display?
Sounds doable but before I do that I would like to make sure that there is no option in ESPEasy to populate a variable with some dummy device via outgoing HTTP request from Homey.
That would be a few minutes of configuring a flow in Homey with an outgoing HTTP request card rather than a few hours of getting an MQTT setup configured and running smoothly.
Regarding MQTT, there are packages for installing a local server and a client on Homey but I currently don't have those installed.
So, If I install those components and configure MQTT-Import devices in ESPEasy, the MQTT data would be available as variables that I can show on the display?
Sounds doable but before I do that I would like to make sure that there is no option in ESPEasy to populate a variable with some dummy device via outgoing HTTP request from Homey.
That would be a few minutes of configuring a flow in Homey with an outgoing HTTP request card rather than a few hours of getting an MQTT setup configured and running smoothly.
Re: Seting variable on dummy device from Homey
Best solution would be to create a rule that accepts multiple arguments, so it can 'distribute/dispatch' the values locally:
The names can be whatever you want, tasknames must be unique, and valuenames unique within a task.
You can use the values, with optional formatting using [DummyTask#value1] (Formatting options: https://espeasy.readthedocs.io/en/lates ... red-values)
From Homey you can send http://ip.of.your.esp/control?cmd=event ... 1>,<value2>,...
If a value contains spaces or a comma, wrap that argument in quotes.
(Edit: Updated ESP url, adding /control)
Code: Select all
on HandleArguments do // Define your own argument order
TaskValueSet,DummyTask,value1,%eventvalue1%
TaskValueSet,DummyTask,value2,%eventvalue2%
TaskValueSet,DummyTask2,value1,%eventvalue3%
TaskValueSet,DummyTask2,value2,%eventvalue4%
endon
You can use the values, with optional formatting using [DummyTask#value1] (Formatting options: https://espeasy.readthedocs.io/en/lates ... red-values)
From Homey you can send http://ip.of.your.esp/control?cmd=event ... 1>,<value2>,...
If a value contains spaces or a comma, wrap that argument in quotes.
(Edit: Updated ESP url, adding /control)
Last edited by Ath on 12 Jul 2023, 11:36, edited 1 time in total.
/Ton (PayPal.me)
Re: Seting variable on dummy device from Homey
Just one more tip, you can test those commands/events via the command input line on the Tools page.
After entering such a command, the page will reload and the full URL for that specific command will be shown in the browser's URL field.
This will make it much easier to see where special formatting may be required.
After entering such a command, the page will reload and the full URL for that specific command will be shown in the browser's URL field.
This will make it much easier to see where special formatting may be required.
Re: Seting variable on dummy device from Homey
Thanks for the replies. Appreciate the help!
I tried it this morning and the solution I got working did not use the rules. Just a direct call to TaskValueSet.
Please let me know if this is not a good option.
For those on the same quest later. What I did in Homey was to create a flow triggered by a sensor value change and then the standard Homey "Make HTTP request" found under the category Logic.
For testing purposes, I created a device of type "Generic - Dummy Device" and named it DummyDeviceName.
In the settings of that device, I created a value to store my data, called DummyValueName
The URL that worked for me was this, where the comma signs were replaced with %2C
http://192.168.5.5/control?cmd=TaskValu ... Name%2C123
Replace the IP with the one of your ESP board.
I tried it this morning and the solution I got working did not use the rules. Just a direct call to TaskValueSet.
Please let me know if this is not a good option.
For those on the same quest later. What I did in Homey was to create a flow triggered by a sensor value change and then the standard Homey "Make HTTP request" found under the category Logic.
For testing purposes, I created a device of type "Generic - Dummy Device" and named it DummyDeviceName.
In the settings of that device, I created a value to store my data, called DummyValueName
The URL that worked for me was this, where the comma signs were replaced with %2C
http://192.168.5.5/control?cmd=TaskValu ... Name%2C123
Replace the IP with the one of your ESP board.
Re: Seting variable on dummy device from Homey
Well, the advantage of using a rule is to make it more flexible and less ESP-specific, if you want to re-use that url for another device, then it will need to have exactly the same dummy device configuration, and, maybe even more important, it can handle multiple values in one call that can be applied to different destinations, that's why I called it a dispatcher. Now you only have to implement that rule on each device, and it can do/use whatever is appropriate .
Comma's being replaced by %2C is just simple url-encoding, applied by Homey.
/Ton (PayPal.me)
Re: Seting variable on dummy device from Homey
Thanks for the feedback Ath. I will keep this in mind for when the number of ESPs grows
Re: Seting variable on dummy device from Homey
Good to use "when" here and not "if"
Who is online
Users browsing this forum: No registered users and 31 guests