pdw-mb / tsmart_ha

Support for Tesla T-Smart thermostats in Home Assistant
11 stars 4 forks source link

Rearchitect to support specified IP addresses and temperature calculation method #18

Closed andrew-codechimp closed 4 months ago

andrew-codechimp commented 8 months ago

Support for manually entering IP address, addresses #9 & #11 A proper config entry rather than re-discover at start, if a device becomes available after HA startup it will now be enabled. A config option to change the method of calculating the temperature, defaults to average, addresses #16 Added a current temperature sensor for easy automations/dashboards. General tidy up as detailed below. Version bump to 0.4.4 Tested on my own vertical mount heater with latest firmware, the High value seems to match the app/display for me but this may change for horizontal mount ones, hence allowing user choice on which method to use.

Important implications of changes T-Smart devices need to have a fixed IP address since we are now storing this rather than discovering on start, the readme is updated to state this. Users will have to remove/re-add devices so that the IP address is stored in the config, one time annoyance that should be mentioned in the release notes.

Notes on changes Moved tsmart library into custom component to allow rearchitecture of both, can be moved back into library but it makes it tricky to make changes when there's that dependency.

Re-ordered params of TSmart class, mandatory IP but optional id & name to allow resolution later.

New async_get_configuration method within library to allow getting of device_id and name, don't get all fields as we won't need them, might be nice to decode the hw/firmware version as you can add them to HA devices view.

New request_successful property to show failure on init.

Exposed temperature high, low and average as attributes in climate sensor.

Coordinators now loaded at platform init and shared between entities of the same device.

Discovery now in config flow with timeout prompting for manual IP.

Config flow now allows re-configure to change IP.

Config entries store IP address, id and name of device and used at component load rather than discovery, allows device to come online after HA start and be recognised.

Added min HA version checking to be 2024.2 to cope with new climate requirements.

Updated readme with HACS easy install link, also specifying to use a fixed IP.

Add VS Code Dev Container allowing you to run a HA instance in docker, doesn't interfere with other dev workflow. UDP seems to not work with docker yet but having a container is still good for other areas.

NikNakk commented 7 months ago

I've just tested this version after having difficulties getting 0.3.0 to detect my new T-Smart. It seems to work well, though the IP address field is not labelled in the setup which could be confusing. (On the other hand, it is labelled when going back into Configure.) This is on the official iPhone Home Assistant app.

andrew-codechimp commented 7 months ago

I've just tested this version after having difficulties getting 0.3.0 to detect my new T-Smart. It seems to work well, though the IP address field is not labelled in the setup which could be confusing. (On the other hand, it is labelled when going back into Configure.) This is on the official iPhone Home Assistant app.

Thanks for testing my version. I've seen this issue before in other integrations but never managed to track it down, a browser refresh seems to fix it. I've also added a default strings which I've seen in other integrations just in case that's the cause.