Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warnings/Errors on startup - MQTT state #287

Closed
2 tasks done
jazzyisj opened this issue Sep 9, 2021 · 2 comments
Closed
2 tasks done

Warnings/Errors on startup - MQTT state #287

jazzyisj opened this issue Sep 9, 2021 · 2 comments
Labels
bug Something isn't working

Comments

@jazzyisj
Copy link

jazzyisj commented Sep 9, 2021

Checklist

  • I checked for similar existing issues (both open and closed) before posting.
  • I am running the latest version.

Expected behavior

No warnings/errors on startup.

Actual behavior

Warnings appear in log during startup before alarmo is loaded. I think alarmo is accepting MQTT state updates before it is ready?

Restart when armed in Home mode

2021-09-09 16:09:09 DEBUG (MainThread) [custom_components.alarmo.alarm_control_panel] alarm_arm_home
2021-09-09 16:09:09 WARNING (MainThread) [custom_components.alarmo.alarm_control_panel] Mode armed_home is not supported, ignoring.
2021-09-09 16:09:09 DEBUG (MainThread) [custom_components.alarmo.alarm_control_panel] alarm_control_panel.alarmo is added to hass
2021-09-09 16:09:09 DEBUG (MainThread) [custom_components.alarmo.alarm_control_panel] Initial state is armed_home
2021-09-09 16:09:09 DEBUG (MainThread) [custom_components.alarmo.alarm_control_panel] Waiting for all sensors to be ready...

Restart when armed in Away mode

2021-09-09 16:22:55 DEBUG (MainThread) [custom_components.alarmo.alarm_control_panel] alarm_arm_away
2021-09-09 16:22:55 WARNING (MainThread) [custom_components.alarmo.alarm_control_panel] Mode armed_away is not supported, ignoring.
2021-09-09 16:22:55 DEBUG (MainThread) [custom_components.alarmo.alarm_control_panel] alarm_control_panel.alarmo is added to hass
2021-09-09 16:22:55 DEBUG (MainThread) [custom_components.alarmo.alarm_control_panel] Initial state is armed_away
2021-09-09 16:22:55 DEBUG (MainThread) [custom_components.alarmo.alarm_control_panel] Waiting for all sensors to be ready...

2021-09-09 16:36:09 DEBUG (MainThread) [custom_components.alarmo.alarm_control_panel] alarm_disarm
2021-09-09 16:36:09 ERROR (MainThread) [homeassistant.util.logging] Exception in async_message_received when handling msg on 'alarmo/command': '{"command":"DISARM","code":"XXXX"}'
Traceback (most recent call last):
File "/config/custom_components/alarmo/mqtt.py", line 259, in async_message_received
await entity.async_alarm_disarm(code, skip_code)
File "/config/custom_components/alarmo/alarm_control_panel.py", line 322, in async_alarm_disarm
(res, info) = self._validate_code(code, STATE_ALARM_DISARMED)
File "/config/custom_components/alarmo/alarm_control_panel.py", line 283, in _validate_code
if state == STATE_ALARM_DISARMED and not self._config[const.ATTR_CODE_DISARM_REQUIRED]:
KeyError: 'code_disarm_required'
Traceback (most recent call last):
File "/config/custom_components/alarmo/mqtt.py", line 259, in async_message_received

Restart when disarmed

2021-09-09 17:16:33 DEBUG (MainThread) [custom_components.alarmo.alarm_control_panel] alarm_disarm
2021-09-09 17:16:33 INFO (SyncWorker_1) [pychromecast] Querying device status
2021-09-09 17:16:33 ERROR (MainThread) [homeassistant.util.logging] Exception in async_message_received when handling msg on 'alarmo/command': '{"command":"DISARM","code":"XXXX"}'
Traceback (most recent call last):
File "/config/custom_components/alarmo/mqtt.py", line 259, in async_message_received
await entity.async_alarm_disarm(code, skip_code)
File "/config/custom_components/alarmo/alarm_control_panel.py", line 322, in async_alarm_disarm
(res, info) = self._validate_code(code, STATE_ALARM_DISARMED)
File "/config/custom_components/alarmo/alarm_control_panel.py", line 283, in _validate_code
if state == STATE_ALARM_DISARMED and not self._config[const.ATTR_CODE_DISARM_REQUIRED]:
KeyError: 'code_disarm_required'
2021-09-09 17:16:34 INFO (MainThread) [homeassistant.components.select] Setting up select.zwave_js
2021-09-09 17:16:34 INFO (MainThread) [homeassistant.components.binary_sensor] Setting up binary_sensor.zwave_js
2021-09-09 17:16:34 INFO (MainThread) [homeassistant.components.fan] Setting up fan.zwave_js
2021-09-09 17:16:34 DEBUG (MainThread) [custom_components.alarmo.alarm_control_panel] alarm_control_panel.alarmo is added to hass
2021-09-09 17:16:34 DEBUG (MainThread) [custom_components.alarmo.alarm_control_panel] Initial state is disarmed
2021-09-09 17:16:34 DEBUG (MainThread) [custom_components.alarmo.alarm_control_panel] entity alarm_control_panel.alarmo was updated from None to disarmed

Steps to Reproduce

  • Alarmo MQTT enabled

  • MQTT alarm panel connected to broker (I'm using Android MQTT Alarm Panel)

  • Restart HA

  • Errors appear in log during restart.

  • After startup errors do not occur after startup, everything works as expected

  • Errors do not occur when MQTT alarm panel is not connected to broker even if MQTT enabled.

  • Retain MQTT Message in app setting makes no difference (occurs when either on or off).

@nielsfaber
Copy link
Owner

Duplicate of #249
Please continue the discussion here (feel free to copy your issue to there).

Retain MQTT Message in app setting makes no difference (occurs when either on or off).

I have my doubts about this.
It is almost certain to me that you try to arm/disarm alarmo through MQTT immediately upon startup of HA.
Alarmo is not ready for messages during initialization, it is built to restore its previous state.

You should try some 'mqtt sniffer' application (e.g. mosquitto_sub for linux) and see what traffic happens on the command topic.
Maybe the topic needs to be 'wiped' after removing the retain setting. I once made a little script for that, but it comes down to writing null to the topic.

Funny that you keep your own issue list for problems in your setup 😄

@jazzyisj
Copy link
Author

I apologize for the dupe, it didn't appear to be a related issue to me.

I finally had a chance to play with this. My mqtt broker was retaining a command topic that must have got sent when the retained setting got turned on and wasn't deleting it when the setting was turned off. I deleted the command topic in my broker, cleared the cache in the app and all seems ok now.

Thanks for taking the time to look at it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants