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 room_temperature attribute for Sinope floor heat thermostat #325

Draft
wants to merge 2 commits into
base: dev
Choose a base branch
from

Conversation

decompil3d
Copy link

Hi folks - this is my first time contributing here. I've got this Sinope floor heat thermostat. The quirk for it already knows about the room_temperature attribute. But I want to expose that attribute as a Home Assistant sensor.

I think this is how to do it, but I'd appreciate any feedback. Also, I'm not sure how to test this - is there an easy way to try this on my HA instance to verify that it works?

Thanks for your help!

@TheJulianJES
Copy link
Contributor

This won't create a new entity. It'll only initialize (read) the room_temperature attribute upon pairing.
We should be able to create a new sensor entity via a v2 quirk.

The original TH1300ZB v1 quirk would have to be converted to a v2 quirk first.
Then, we can add .sensor. Take a look at other quirks in the repo that use .sensor or .tuya_sensor.

In the end, it should look something like this I think:

(
    QuirkBuilder(SINOPE, "TH1300ZB")
    .replaces(SinopeTechnologiesElectricalMeasurementCluster)
    .replaces(SinopeTechnologiesThermostatCluster)
    .replaces(SinopeTechnologiesManufacturerCluster)
    .sensor(
        attribute_name=SinopeTechnologiesManufacturerCluster.AttributeDefs.floor_temperature.name,
        cluster_id=SinopeTechnologiesManufacturerCluster.cluster_id,
        device_class=SensorDeviceClass.TEMPERATURE,
        state_class=SensorStateClass.MEASUREMENT,
        unit=UnitOfTemperature.CELSIUS,
        translation_key="room_temperature",
        fallback_name="Room temperature",
    )
    .add_to_registry()
)

Drafting this PR for now.

@TheJulianJES TheJulianJES marked this pull request as draft January 27, 2025 17:55
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

Successfully merging this pull request may close these issues.

2 participants