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

Publishing to self_topic_root/reload no longer works #59

Open
drinfernoo opened this issue Sep 21, 2021 · 3 comments
Open

Publishing to self_topic_root/reload no longer works #59

drinfernoo opened this issue Sep 21, 2021 · 3 comments

Comments

@drinfernoo
Copy link
Collaborator

Describe the Bug

I added a new sensor today, and after modifying sensors.yaml to change the name and device class, tried publishing to wyzesense2mqtt/reload... But that just makes the container stop working. During this process, I was tailing the container log (docker logs -f wyzesense2mqtt), and nothing happened after the reload message was received, including any further state updates from the sensors. Restarting the container restored regular behavior.

Steps To Reproduce

Steps to reproduce the behavior:

  1. Publish a message to self_topic_root/reload

Expected Behavior

Publishing a reload message should... reload the sensors 😅

Additional Context

The last bit of my log, and then nothing happened after this:

Sending PUBLISH (d0, q2, r1, m12685), 'b'wyzesense2mqtt/77C006C8'', ... (239 bytes)
Received PUBREC (Mid: 12685)
Sending PUBREL (Mid: 12685)
Received PUBCOMP (Mid: 12685)
State event data: [2021-09-20 17:15:40][77C00CE1]AlarmEvent: sensor_type=motionv2, state=active, battery=98, signal=72
{'event': 'alarm', 'available': True, 'mac': '77C00CE1', 'device_class': 'motion', 'last_seen': 1632183340.093, 'last_seen_iso': '2021-09-20T17:15:40.093000', 'signal_strength': -72, 'battery': 98, 'name': 'Back Porch Motion', 'state': 1}
Sending PUBLISH (d0, q2, r1, m12686), 'b'wyzesense2mqtt/77C00CE1'', ... (238 bytes)
Received PUBREC (Mid: 12686)
Sending PUBREL (Mid: 12686)
Received PUBCOMP (Mid: 12686)
Received PUBLISH (d0, q0, r0, m0), 'wyzesense2mqtt/reload', ...  (0 bytes)
In on_message_reload:
Reading sensors configuration...
@AK5nowman
Copy link
Collaborator

@drinfernoo Can you check to ensure the formatting on your sensors.yaml file is correct? Though I would expect this to print an error...hmm.
Try adding the following before 181

if (SENSORS is None):
        LOGGER.error(f"Failed to load sensors.yaml.")

@drinfernoo
Copy link
Collaborator Author

Adding those lines, and then publishing to wyzesense2mqtt/reload... allowed the reload to work. Maybe the issue I was experiencing was a fluke, but it seemed like it would happen every time 🤔

Those lines shouldn't have affected the behavior of the script, from what I can tell... though there are a few lines lower that might fail if SENSORS is None:

for sensor_mac in SENSORS:

for sensor_mac in SENSORS:

But as you mentioned, I would think these would give an error.

My sensors.yaml is definitely formatted correctly... or none of my sensors would work at all 😉

@drinfernoo
Copy link
Collaborator Author

I still have this odd behavior... wondering what we can do to fix this 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants