shauntarves / wyze-sdk

A modern Python client for controlling Wyze devices.
The Unlicense
306 stars 50 forks source link

Thermostat Room Sensors #94

Closed jamespet77 closed 1 year ago

jamespet77 commented 1 year ago

Is is possible to get the data from the thermostat room sensors?

shauntarves commented 1 year ago

Hey @jamespet77, thanks for the question. I would love to add support for these! I didn't even know they existed until now.

So, what typically will happen with something like this is that I would need you to share the devices with me (temporarily) via the app. There is at least one open bug for the thermostat, so if you could share the sensor(s) and the thermostat, I can add support for this. My email for the Wyze account is shaun tarves net

jamespet77 commented 1 year ago

I can do that.
just to confirm its shaun at tarves dot net

shauntarves commented 1 year ago

Yessir!

On Mon, Oct 10, 2022 at 6:09 PM James Peterson @.***> wrote:

I can do that. just to confirm its shaun at tarves dot net

— Reply to this email directly, view it on GitHub https://github.com/shauntarves/wyze-sdk/issues/94#issuecomment-1273860717, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABEDBMATVSAWKTPO5ORBHDDWCSHZPANCNFSM6AAAAAARA6SWD4 . You are receiving this because you commented.Message ID: @.***>

jamespet77 commented 1 year ago

Sent. It has one room sensor linked. I have another room sensor if you need multiple.

shauntarves commented 1 year ago

@jamespet77 I've just pushed initial support for reading room sensor data to branch 94-thermostat-room-sensors

You can get a list of sensors connected to a thermostat by issuing:

sensors = client.thermostats.get_sensors(device_mac=<device_id>, device_model='CO_EA1')

The sensor object looks like this:

for _sensor in sensors:
    print(f"    id: {_sensor.did}")
    print(f"        name: {_sensor.nickname}")
    print(f"        temperature: {_sensor.temperature}")
    print(f"        humidity: {_sensor.humidity}")
    print(f"        battery: {_sensor.battery}")
    print(f"        state: {_sensor.state}")
    print(f"        status: {_sensor.status}")
    print(f"        auto_comfort_mode: {_sensor.auto_comfort_mode}")
    print(f"        comfort_balance_weight: {_sensor.comfort_balance_weight}")
    print(f"        temperature_threshold: {_sensor.temperature_threshold}")

id: CO_TH1_XXXX
        name: Kitchen
        temperature: 73.86
        humidity: 33
        battery: RoomSensorBatteryLevel.LEVEL_3
        state: RoomSensorStateType.ONLINE
        status: RoomSensorStatusType.MANUAL_UP
        auto_comfort_mode: ThermostatSensorTemplate.HOME_SLEEP
        comfort_balance_weight: ThermostatSensorComfortBalanceMode.BALANCE
        temperature_threshold: 5
jamespet77 commented 1 year ago

Thanks Shaun!! big help. Wyze needsto put you on the team.

shauntarves commented 1 year ago

Give it a try and make sure it's working for your use cases. If so, I'll merge to master and make a new release.

I'm going to use this opportunity to address https://github.com/shauntarves/wyze-sdk/issues/51 and https://github.com/shauntarves/wyze-sdk/issues/42 so might be a few days.

On Wed, Nov 2, 2022 at 2:44 PM James Peterson @.***> wrote:

Thanks Shaun!! big help. Wyze needsto put you on the team.

— Reply to this email directly, view it on GitHub https://github.com/shauntarves/wyze-sdk/issues/94#issuecomment-1301068758, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABEDBMFOWK3UQITWXP6Z3VTWGKZA3ANCNFSM6AAAAAARA6SWD4 . You are receiving this because you were assigned.Message ID: @.***>

jamespet77 commented 1 year ago

It is working. I might suggest returning an empty list instead of None if there are no room sensors? Either way. It's working. I can get what I need now.