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

Add support for binary sensor (digital input) in Home Assistant discovery #586

Merged
merged 2 commits into from Jan 6, 2023

Conversation

Xinayder
Copy link
Contributor

@Xinayder Xinayder commented Jan 5, 2023

This change was motivated by a door/window sensor from Tuya, where I had to manually publish the discovery payload for the sensor (after converting to OpenBK) otherwise HASS would report the sensor as unavailable after a reboot or integration reload.

I had to change get_Relay_PWM_Count, and I found out it is also used by a Tasmota-related function, but that remains to be done as I have no idea how it would work to report or configure a binary sensor for Tasmota.

@openshwprojects
Copy link
Owner

Seems like a great change, from a brief glance at code it seems ok but @iprak knows more about discovery.

@iprak , can you please take a look at this pull request and tell me if I can merge it?

@iprak
Copy link
Contributor

iprak commented Jan 5, 2023

That looks great.

@openshwprojects
Copy link
Owner

It seems that BL602 and W800 fails to build

@iprak
Copy link
Contributor

iprak commented Jan 6, 2023

@Xinayder I think the build failures are due to hass_init_binary_sensor_device_info missing in the header file (hass.h). Although I am not sure why build for other chips succeeded.

@Xinayder
Copy link
Contributor Author

Xinayder commented Jan 6, 2023

I just submitted a commit to fix these build issues.

The hass_init_binary_sensor_device_info function was inside the #ifndef OBK_DISABLE_ALL_DRIVERS block, so it failed for one specific chip. Some functions were also missing from their associated header files, now it should work.

Although I tried building for OpenXR809 and after fixing all these issues, the build seems to fail for some unrelated problems.

EDIT: might want to squash these commits when merging

@openshwprojects openshwprojects merged commit 5f50906 into openshwprojects:main Jan 6, 2023
@openshwprojects
Copy link
Owner

Thank you!

@github-actions
Copy link

github-actions bot commented Jan 6, 2023

🎉 This PR is included in version 1.15.292 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

None yet

3 participants