I currently have the following automation that does an mqtt “broadcast” and I need to convert it to a targeted http put. Really not sure how to pull this off. Looks like the rest api is what I need?
This is used with ESPEasy devices and they are limited to 4 mqtt import tasks and so far the software has worked with 8, but not so going forward.
So, I have to build a switch? It cannot be called directly as an action from an automation? I guess I expected something like “http publish” or http send" as an actionable item.
That makes sense… I have had to template a couple of things so far and I just do not understand the process. If I did, I have a feeling it would make my life in HA easier. Just like python, it would help. I do not come from a programming background, networking and infrastructure are where my skills are strongest.
I will throw something like this in HA and report back once it is refined, as I did not find anything like this in my search. Will have a go at the links again, just do not get it. I am getting better at json!
Basically means: create a temp variable called ‘state’, assign it the value {{ states.sensor.pws_temp_f.state }} and pass it as data to the shell_command.
Your shell command then replaces all instances of {{state}} with its value.
I have a few Wemos D1’s with tiny OLED’s and SHT30’s in the house. I would like to display basic outside weather data on them. Currently the above action sends out the data via MQTT and then sends it to the display. Under ESPEasy only 1 MQTT import task is allowed with 4 MQTT imported variables. Under previous versions it would work with 2 MQTT import tasks, though not supported, if you put them in the right task slots. That gave me 8 import slots as follows: temp, feelslike, humidity, wind speed, wind gust speed and wind direction and 2 slots left for mqtt borne commands to reboot the unit and to request an ip number update task.
But, now the 2 MQTT tasks are not working under latest versions, so I have to find a different way to populate one unit which will global sync to the other units. More painful config, but right way to do it.
- id: "Broadcast Real Temp HTTP"
alias: 'Broadcast Real Temp HTTP'
hide_entity: True
trigger:
- platform: time
minutes: '/1'
seconds: '0'
action:
service: shell_command.wu_temp_http
data_template:
state: {{ states.sensor.pws_temp_f.state }}
Results in this error:
invalid key: "OrderedDict([('states.sensor.pws_temp_f.state', None)])" in "/config/automation/http.yaml", line 11, column 0
4:46 PM helpers/entity_component.py (ERROR)
I have tried a few things and just can’t get the automation to load. What is wrong with it? The sensor is there and is named the same… The automations are split out of configuration.yaml, so the format is a tad different.