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

Making Siterwell TRVs using presets modes #1104

Closed
wants to merge 1 commit into from

Conversation

MattWestb
Copy link
Contributor

Future changes for the TRV:

  1. Making the quirk using presets Away, Schedule and Manual instead of system mode (the TRV is not supporting on/off its always working)(need adding Siterwell presets in ZHA) and ZHA is not supporting Schedule (Schedule_programming_mode) as system mode only as occupancy presets.
  2. Deleting in device not implanted attribute:
    SITERWELL_VALVE_STATE_ATTR = 0x026D # [0,0,0,55] opening percentage
  3. Adding in device supported attribute:
    SITERWELL_WINDOW_ALARM_ATTR = 0x0411 # [0] clear [1] alarm
    SITERWELL_VALVE_JAMMED_ATTR = 0x0413 # [0] clear [1] alarm
    but not in the ZHA GUI (upcoming).
  4. Adding switch for SiterwellChildLock in ZHA GUI but its only working setting.
  5. Adding max and min heating so ZHA is showing the right scale.
  6. Deleting "electric" then is one copy and paste from the original electric heating thermostat that is having one own quirk.

Missing upcoming futures for the TRV:

    1. Switches with status update from the local state shall being implanted for window and valve detect.
    1. Status sensor for "window is open" and "valve is jammed" shall being implanted.
    1. Battery attribute with type and quantity shall being implanted (AA and 2 or 3 batteies for new TRV types).

Away mode is showing idle in ZHA without setpoint temperature but it can being set on the TRV or by cluster attribute.

Look at #1084 for more information.

Making Siterwell TRVs using preset modes instead of system mode that is not working OK with this devices.
@MattWestb
Copy link
Contributor Author

This PR shall being merged with one PR for adding presets to ZHA or its not working.
By adding this in the end of climate.py in ZHA:

@STRICT_MATCH(
    channel_names=CHANNEL_THERMOSTAT,
    manufacturers={
        "_TYST11_jeaxp72v",
        "_TYST11_kfvq6avy",
        "_TYST11_zivfvd7h",
        "_TYST11_hhrtiq0x",
        "_TYST11_ps5v5jor",
        "_TYST11_owwdxjbx",
        "_TYST11_8daqwrsj",
        "_TZE200_jeaxp72v",
        "_TZE200_kfvq6avy",
        "_TZE200_zivfvd7h",
        "_TZE200_hhrtiq0x",
        "_TZE200_ps5v5jor",
        "_TZE200_owwdxjbx",
        "_TZE200_8daqwrsj",
    },
)
class SiterwellThermostat(Thermostat):
    """Siterwell Thermostat implementation."""

    def __init__(self, unique_id, zha_device, channels, **kwargs):
        """Initialize ZHA Thermostat instance."""
        super().__init__(unique_id, zha_device, channels, **kwargs)
        self._presets = [
            PRESET_NONE,
            PRESET_AWAY,
            PRESET_SCHEDULE,
        ]
        self._supported_flags |= SUPPORT_PRESET_MODE

    @property
    def hvac_modes(self) -> tuple[str, ...]:
        """Return only the heat mode, because the device can't be turned off."""
        return (HVAC_MODE_HEAT,)

    async def async_attribute_updated(self, record):
        """Handle attribute update from device."""
        if record.attr_name == "operation_preset":
            if record.value == 0:
                self._preset = PRESET_AWAY
            if record.value == 1:
                self._preset = PRESET_SCHEDULE
            if record.value == 2:
                self._preset = PRESET_NONE
        await super().async_attribute_updated(record)

    async def async_preset_handler(self, preset: str, enable: bool = False) -> bool:
        """Set the preset mode."""
        mfg_code = self._zha_device.manufacturer_code
        if not enable:
            return await self._thrm.write_attributes(
                {"operation_preset": 0}, manufacturer=mfg_code
            )
        if preset == PRESET_AWAY:
            return await self._thrm.write_attributes(
                {"operation_preset": 1}, manufacturer=mfg_code
            )
        if preset == PRESET_SCHEDULE:
            return await self._thrm.write_attributes(
                {"operation_preset": 2}, manufacturer=mfg_code
            )

        return False

@MattWestb
Copy link
Contributor Author

HELP NEEDED !!

Then changing the logic for system mode change to occupancy presets its braking the 2 test for the quirk and is over my knowledge.
So some with the knowledge pleas help fixing the test code and also the code i have putting in if its not OK.

Mvh Mattias W

@MattWestb
Copy link
Contributor Author

Its look like this is one dead end for all Siterwell TRVs is staying with 75% broken functionality ;-(

@MattWestb
Copy link
Contributor Author

Closing then @jacekk015 is doing one new PR.
#1192

@MattWestb MattWestb closed this Nov 29, 2021
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.

1 participant