Open emontnemery opened 3 years ago
HA 2021.12 Log Messatge:
2021-12-12 22:00:00 ERROR (MainThread) [homeassistant.components.automation.zigbee_map_aktualisieren] While executing automation automation.zigbee_map_aktualisieren
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/automation/__init__.py", line 508, in async_trigger
await self.action_script.async_run(
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1259, in async_run
await asyncio.shield(run.async_run())
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 363, in async_run
await self._async_step(log_exceptions=False)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 381, in _async_step
await getattr(self, handler)()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 584, in _async_call_service_step
await service_task
File "/usr/src/homeassistant/homeassistant/core.py", line 1495, in async_call
task.result()
File "/usr/src/homeassistant/homeassistant/core.py", line 1530, in _execute_service
await handler.job.target(service_call)
File "/config/custom_components/zigbee2mqtt_networkmap/__init__.py", line 91, in update_service
mqtt.async_publish(topic+'/bridge/networkmap/routes', 'graphviz')
TypeError: async_publish() missing 1 required positional argument: 'payload'
Looks like the Code in Question is:
# Service to publish a message on MQTT.
async def update_service(call):
"""Service to send a message."""
tmpVar.received_update = False
tmpVar.update_data = None
tmpVar.last_update = None
mqtt.async_publish(topic+'/bridge/networkmap/routes', 'graphviz') # <------------
change this line to:
await mqtt.async_publish(hass, topic+'/bridge/networkmap/routes', 'graphviz')
and restart HASS
@SlavikS-PL Awesome, it works again, THX! I've messed around with it code myself, trying to fix it myself without any luck.
Maybe this must be changed too:
await mqtt.async_subscribe(topic+'/bridge/networkmap/graphviz', message_received)
to:
await mqtt.async_subscribe(hass, topic+'/bridge/networkmap/graphviz', message_received)
?
EDIT: There is already a pull request with the fix: https://github.com/rgruebel/ha_zigbee2mqtt_networkmap/pull/44
mqtt.async_publish
is a couroutine in HA core 2021.12: home-assistant/core#58441This is a breaking change, and the custom component will stop working if not adapted. This can be solved as suggested here: https://github.com/blakeblackshear/frigate-hass-integration/pull/166