I’m trying to wrap my head around formatting an automation for controlling my pool over an RS485 interface:
Another user here has graciously shared how they got it working on their similar system, however I’m getting errors when trying to use an MQTT publish automation to set the pool heater.
Here’s what my automation looks like:
- alias: convert_setpoint
trigger:
platform: mqtt
topic: pool/setPoint
action:
service: mqtt.publish
data_template:
topic: easytouch2-8/state/body/setPoint
payload: '{ "id": 1, "setPoint": {{trigger.payload | int }} }'
And here’s the log error I’ve been seeing whenever I use the pool heater’s climate control card to change the temperature:
TypeError: payload must be a string, bytearray, int, float or None.
2020-11-15 08:07:12 ERROR (MainThread) [homeassistant.components.automation.convert_setpoint] While executing automation automation.convert_setpoint
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/automation/__init__.py", line 426, in async_trigger
await self.action_script.async_run(
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1010, in async_run
await asyncio.shield(run.async_run())
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 245, in async_run
await self._async_step(log_exceptions=False)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 253, in _async_step
await getattr(
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 460, in _async_call_service_step
await service_task
File "/usr/src/homeassistant/homeassistant/core.py", line 1448, in async_call
task.result()
File "/usr/src/homeassistant/homeassistant/core.py", line 1483, in _execute_service
await handler.job.target(service_call)
File "/usr/src/homeassistant/homeassistant/components/mqtt/__init__.py", line 581, in async_publish_service
await hass.data[DATA_MQTT].async_publish(msg_topic, payload, qos, retain)
File "/usr/src/homeassistant/homeassistant/components/mqtt/__init__.py", line 782, in async_publish
msg_info = await self.hass.async_add_executor_job(
File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py", line 1259, in publish
raise TypeError(
TypeError: payload must be a string, bytearray, int, float or None.
I suspect there’s something off with the way I’m formatting that last very last line in my autiomation.yaml?
Everything before that seems to work based on the MQTT messages that I’m seeing.