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

Heartbeat and Touch Input event. label:enhancement #16

Open
jusplainmike opened this issue Jan 11, 2022 · 3 comments
Open

Heartbeat and Touch Input event. label:enhancement #16

jusplainmike opened this issue Jan 11, 2022 · 3 comments

Comments

@jusplainmike
Copy link

I was looking at your code trying to figure out how to add two extra mqtt events. One to send out a status of the connection on something like Relay01/status "ONLINE". I was thinking maybe on the same timer that checks the relays and humidity or when connection is setup to mqtt. Could add a last will for "OFFLINE". Also I noticed you are able to detect touch screen inputs but it doesn't send any mqtt messages. I wanted to create a screensaver of sorts. I have MagicMirror and Homeassistant web portals both on the home screen. I use Tasker and AutoInput to switch between them after an amount of inactivity. I would like to keep magic mirror displayed when waking the screen from proximity and if touched switch to homeassistant, a kind of crude screensaver I guess. Would it be difficult to send mqtt payloads on those two events? I have been trying to hack together a solution with my poor understanding of C but to no avail.

@jimpastos
Copy link
Owner

There are no timers for state checks. Proximity, humidity and temp are only updated when they change.

Sending an ONLINE state is trivial but you won't know when its offline, unless the device sends periodic heartbeats indicating its online and anyone listening has logic to know that online state is only valid for a certain amount of time. (Which I believe MQTT Sensors do in HomeAssistant, but we don't follow that flow)

Not exactly sure what you are asking for the second part. Proximity and Screen state is sent. We can't really send events on touches because they are VERY noisy (hundreds of events when touching/dragging).
Can you not work off the Screen state when its On/Off?

Maybe breakdown your flow/requirements and we can figure out any intermediate events that can be sent.

@jusplainmike
Copy link
Author

jusplainmike commented Jan 12, 2022

There is a line in your code every 500s to check the relay state, temp and humidity. Also can we not use the Last Will and Testament feature for status? Have it set to OFFLINE.

** I will update this post with my workflow and possible requirements tomorrow. Late here and I'm doing a poor job describing my process. **

@jimpastos
Copy link
Owner

You’re right. Haven’t looked at the code in ages :). I was mixing up the sensor (proximity and buttons) blocking polls with temp/humidity data.
i’ll wait for your follow up

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