home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.99k stars 31.03k forks source link

Genius Hub - plug status no longer visible as binary_sensor #103195

Open RogerSelwyn opened 1 year ago

RogerSelwyn commented 1 year ago

The problem

Genius Hub plugs used to appear as a binary_sensor which showed if it was on or off, and a switch which allowed the plug to be "boosted".

The binary sensor is no longer created as part of the integration, I think as a results of this PR - https://github.com/home-assistant/core/pull/102112

What version of Home Assistant Core has the issue?

core-2023.11.0

What was the last working version of Home Assistant Core?

core-2023.10.x

What type of installation are you running?

Home Assistant Supervised

Integration causing the issue

Genius Hub

Link to integration documentation on our website

https://www.home-assistant.io/integrations/geniushub/

Diagnostics information

No response

Example YAML snippet

geniushub:
  host: !secret genius_host
  username: !secret genius_username
  password: !secret

Anything in the logs that might be useful for us?

None

Additional information

No response

home-assistant[bot] commented 1 year ago

Hey there @manzanotti, mind taking a look at this issue as it has been labeled with an integration (geniushub) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `geniushub` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign geniushub` Removes the current integration label and assignees on the issue, add the integration domain after the command.

(message by CodeOwnersMention)


geniushub documentation geniushub source (message by IssueLinks)

RogerSelwyn commented 1 year ago

@GeoffAtHome could you take a look since you raised the PR?

GeoffAtHome commented 1 year ago

Will do when home in a few days.

GeoffAtHome commented 1 year ago

@RogerSelwyn the intention of PR - https://github.com/home-assistant/core/pull/102112 was to stop smart plugs appearing as switches and sensors. A switch is either "on" or "off".

Please clarify why this creates a problem for you. Sorry if I am missing the point.

RogerSelwyn commented 1 year ago

The two entities do two different things, they don’t both show the state of the plug. The binary sensor shows if the plug is on or off. The switch boosts the plug (for one hour I think). So if you enable the binary_sensor (revert to old code) then in genius app turn on the plug, you will see the binary sensor is on but the switch is off. If you turn the switch on, look in the genius app and you will see the plug has been boosted.

manzanotti commented 1 year ago

@GeoffAtHome I haven't had a chance to investigate this yet, so I don't know if this is related, but I've just done a fresh install of HA on my Pi, and neither of my smart witches are even showing in HA.

RogerSelwyn commented 1 year ago

@GeoffAtHome I haven't had a chance to investigate this yet, so I don't know if this is related, but I've just done a fresh install of HA on my Pi, and neither of my smart witches are even showing in HA.

You can try putting the old version in custom_components (as I have done) and see if they appear....

GeoffAtHome commented 1 year ago

@manzanotti PR - https://github.com/home-assistant/core/pull/102112 I see my smart plugs as switches Prior to this PR I see my smart plugs as switches and binary sensors.

@RogerSelwyn a smart plug should be a switch as it behaves like a switch. A switch is a specialised version of a binary sensor.

A switch displays the state "on" and "off". What is the value of a smart plug being displayed as both a "switch" and a "binary sensor"?

The smart plug status can be retrieved from the state of the switch.

RogerSelwyn commented 1 year ago

The smart plug status can be retrieved from the state of the switch.

Unfortunately, no it can't. As I've said before the switch does a boost (for an hour I think), it does not reflect the status of the plug (unless you've changed that and I don't think you have). The screenshot below whilst using your code. Note switch.plug_dining_room. Off in HA, on in genius Apps

Screenshot 2023-11-05 at 15 56 57

This one shows old code. App shows on, HA binary_sensor shows on, switch shows off.

Screenshot 2023-11-05 at 16 01 13
RogerSelwyn commented 1 year ago

And here I have toggled the switch in the old code. App shows boosted (it is for an hour), both entities on in HA.

Screenshot 2023-11-05 at 16 06 32
RogerSelwyn commented 1 year ago

In case it makes a difference maybe this is a bug in the way the code handles the v3 api, and that the switch should show on when it is scheduled on, but as you can see it doesn't.

If it is meant to show On, then we should look at a bug fix as well. The docs say this:

SWITCH ENTITIES

Switch entities will report back their state; other properties are available via their state attributes. Currently, HA switches do not have modes/presets, so the Home Assistant state will be reported as:

On for Override \ On, and
Off otherwise (NB: the zone could still be ‘on’, e.g., with Timer mode)

I've just always assumed it was mean to be like that, and basically ignore the switch since it is incorrect.

Just to add, if the switch is mean to turn it on. Is it meant to just Boost for an hour, or what is the expectation of what it should do?

RogerSelwyn commented 1 year ago

Sorry, I keep adding more.

The current code shows that the switch will only show on when it is overridden (boosted):

def is_on(self) -> bool:
    """Return the current state of the on/off zone.

    The zone is considered 'on' if & only if it is override/on (e.g. timer/on is 'off').
    """
    return self._zone.data["mode"] == "override" and self._zone.data["setpoint"]
manzanotti commented 1 year ago

@GeoffAtHome If I revert the change in that PR locally, I just see the smart plugs as binary sensors. Where are you seeing them duplicated?

image
GeoffAtHome commented 1 year ago

I get the following when I revert the PR: image

Smart Plugs 4, 6 and 86 are duplicates of Bedroom Socket, Kitchen Socket and Study Socket.

Note that the state of the switch/binary sensors are not is sync which is due to PR https://github.com/home-assistant/core/pull/102110

In async_setup_platform in both switch.py and binary_sensor.py the list of devices in broker.client.zone_objs is filtered to create either a switch or a binary_sensor. In my case, my smart plugs, which are old, are passing the test in switch.py and binary_sensor.py.

In my setup a smart plug identifies it self as:

type: 'Smart Plug'
state: {'outputOnOff': True }

A binary_sensor such as a single channel receiver identifies it self as:


type: 'Single Channel Receiver'
state: {'outputOnOff': True }

From this I see why my smart plugs are added as ```binary_sensors```. 

By the time the list gets to ```switch.py``` the type has been changed from type `Smart Plug` to type `on / off`. I need to find where and why this transformation is being made.

I am not sure why your are not seeing your smart plugs as switches. How are your smart plugs getting identified?
GeoffAtHome commented 1 year ago

The difference is binary_sensors.py is looking at ``broker.client.device_objsandswitches.pyis looking atbroker.client.zone_objs- This is why my switches are getting added twice and hence the need, in my case, to removed them frombinary_sensors.py```

If I could examine the how your smart plugs different from mine may shed some light on the problem.

RogerSelwyn commented 1 year ago

binary_sensor is filtering using broker.client.device_objs. switch is filtering using broker.client.zone_objs. The binary sensor is showing the state of the device. The switch is showing whether the zone is overridden or not.

I see you are trying to alter the switch to act differently, which needs to be identified as a breaking change when it gets merged since it is changing behaviour. I see this has been commented on on that PR.

Can I suggest that PR https://github.com/home-assistant/core/pull/102112 is reverted and then merged with https://github.com/home-assistant/core/pull/102110 since they are dependant on each other. As it stands, there is no entity that reliably shows whether the plug is switched on or not.

RogerSelwyn commented 1 year ago

You need to consider whether providing the status based on the zone is giving the same detail as providing based on device. What happens if a zone is configured with more than one plug (I'm not sure if that is allowed in Genius Hub). Should you still show zone status, or status of both plugs?

GeoffAtHome commented 1 year ago

@RogerSelwyn thanks for your input and discussion.

The question, to me, is what is a smart plugs?

  1. A binary sensor
  2. A switch
  3. Both

In the original implementation this was a binary sensor. This was later changed to both, which in my opinion was wrong. The PR I raised and was to change it to a switch and only a switch.

In the HG app a Zone has a date/time schedule associated with it. Unless you want the switch to come on when the heating comes on, typically the smart plug is placed in it owns zone. Sure, it is possible to place the smart plug in the same zone as the heating. It is even possible to place two smart plugs in the same zone and have these come on and off at the same time.

For most use cases people would want to smart plug to come on and off independently. Hence placing each smart plug in its own zone.

I believe I see why there was a desire to have the smart plug as both a binary sensor and a switch. Both have binary states.

A HG smart plug, when placed in a zone, can have three modes:

  1. Off
  2. Override
  3. Timed

Off is clear and well understood. Override can override to turn the switch ON or OFF Timed is a seven day schedule where the switch can be ON or OFF

The HG smart plug in HA represented as a switch should reflect the state of the switch. That is ON or OFF. The mode of the zone that the smart plug occupies can be retrieved, if required, by a service call.

Trying to reflect the state of the smart plug and mode of zone as a switch and a binary sensor does not make sense to me. The binary sensor cannot reflect the three modes. The switch should only reflect if the plug is ON or OFF.

Sorry for the ramble but I wanted to explain my rational.

If you can provide a use case where having a smart plug as both a binary sensor and a switch adds value please let me know.

RogerSelwyn commented 1 year ago

@GeoffAtHome in general I’m fine with the change but in my view as it stands it is broken because your other PR has not been merged as yet. There is currently nothing that shows the state of the plug if it has been scheduled on rather than overridden on. Your other PR mentions status is only wrong on startup, which in my view is incorrect, it is “wrong” if it hasn’t been overridden. It will switch off again when the override ends (and it isn’t schedule on).

I agree with your view on whether plugs will be grouped or not, I mentioned it because it needs to be considered before a change is made.

GeoffAtHome commented 1 year ago

What I have done is to deprecating a smart plug appearing as a binary sensor. This was made clear in https://github.com/home-assistant/core/pull/102112 . This makes no difference to the state of the plug or to whether it is or is not grouped.

RogerSelwyn commented 1 year ago

You miss my point. I'm fine that you remove that binary_sensor, but that should only be done after the switch is working properly, which it isn't. That will only be the case when PR https://github.com/home-assistant/core/pull/102110 is implemented. At the moment it is broken. The switch shows the override status, not the plug status (as you can see in your screenshot of yesterday, where you noted 102110 was the reason).

I've pretty much said the same thing multiple times now. For me I'll use the old code in custom_components until the core version is functioning again (with or without the binary_sensor, I just want something that is accurate).

GeoffAtHome commented 1 year ago

I think we are on the same page. The switch has always been wrong - 102110 should fix that. Does 102110 fix it for you?

Gowah8 commented 1 year ago

The above seems to concentrate on smart plugs. However, the Genius electric switches also used to report as binary_sensor.electric_switch. But now the Genius electric switch entities are no longer being provided by the geniushub integration. And there are no equivalent switch entities.

GeoffAtHome commented 1 year ago

@Gowah8 is you can capture the JSON returned from your hub we can include the electric switch like a smart plug.

Looking at the other products in the GH shop such as the electric relay and range extender.

The wireless room thermostat is very different from the whole house thermostat that was originally supplied to me.

Let me know if you need help capturing the JSON.

Gowah8 commented 1 year ago

No idea how to capture the JSON

On Thu, 9 Nov 2023, 4:28 pm GeoffAtHome, @.***> wrote:

@Gowah8 https://github.com/Gowah8 is you can capture the JSON returned from your hub we can include the electric switch like a smart plug.

Looking at the other products in the GH shop such as the electric relay and range extender.

The wireless room thermostat is very different from the whole house thermostat that was originally supplied to me.

Let me know if you need help capturing the JSON.

— Reply to this email directly, view it on GitHub https://github.com/home-assistant/core/issues/103195#issuecomment-1804156025, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARPTGQHM65VEXJMWNPEODIDYDUAC5AVCNFSM6AAAAAA6ZYZDZKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMBUGE2TMMBSGU . You are receiving this because you were mentioned.Message ID: @.***>

manzanotti commented 11 months ago

@Gowah8 A fix for the original issue was released in 2023.12.0, can you see if that fixes this issue too?

Gowah8 commented 11 months ago

Currently abroad hence not risking update. Will try on my return in early January.

On Sun, 17 Dec 2023, 8:35 pm Paul Manzotti, @.***> wrote:

@Gowah8 https://github.com/Gowah8 A fix for the original issue was released in 2023.12.0, can you see if that fixes this issue too?

— Reply to this email directly, view it on GitHub https://github.com/home-assistant/core/issues/103195#issuecomment-1859174777, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARPTGQGZRXKYDR257KPZI5TYJ3YKLAVCNFSM6AAAAAA6ZYZDZKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNJZGE3TINZXG4 . You are receiving this because you were mentioned.Message ID: @.***>

Gowah8 commented 10 months ago

Have upgraded to Home Assistant 2024.1 and restarted Genius Hub. Still no entities binary_sensor.electric_switch. Also no entities binary_sensor.smart_plug

On Sun, 17 Dec 2023 at 13:35, Paul Manzotti @.***> wrote:

@Gowah8 https://github.com/Gowah8 A fix for the original issue was released in 2023.12.0, can you see if that fixes this issue too?

— Reply to this email directly, view it on GitHub https://github.com/home-assistant/core/issues/103195#issuecomment-1859174777, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARPTGQGZRXKYDR257KPZI5TYJ3YKLAVCNFSM6AAAAAA6ZYZDZKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNJZGE3TINZXG4 . You are receiving this because you were mentioned.Message ID: @.***>

GeoffAtHome commented 10 months ago

@Gowah8 please attach the JSON for your setup so this can be investigated.

To do that head over to here and follow the instructions.

Once installed run the commands:

python ghclient.py ${HUB_ADDRESS} -u ${USERNAME} -p ${PASSWORD} zones -v
python ghclient.py ${HUB_ADDRESS} -u ${USERNAME} -p ${PASSWORD} devices -v

Replace ${HUB_ADDRESS} with your hub address I.e. 192.168.15.xxx. Same for USERNAME and PASSWORD.

TIA

Gowah8 commented 8 months ago

Finally got around to this. Attached are zones and devices outputs. Relevant switch for wet underfloor heating are KITCHEN & UTIL and FAMILY. Also attached are missing entities from Home Assistant ( note missing UFH Kitchen & Util already deleted) and Genius Hub app devices. As noted previously the UFH used to be available as binary_sensor.electric_switch but became unavaialble around Oct 2023 after HA update, Gowah8 Genius Hub zones & devices.txt Home Asistant Missing Entities Genius Hub devices

Gowah8 commented 7 months ago

GeoffAtHome. Can you help with this. Still no binary sensor for the electric switches

GeoffAtHome commented 7 months ago

@Gowah8 thanks for supplying devices.txt. I see that you have eight 'switches' (devices that support on/off).

Binary sensors are set is the type contains "Receiver". For you this is:

{"id": "3", "type": "Dual Channel Receiver", "assignedZones": [{"name": null}], "state": {"outputOnOff": true}}, 
{"id": "3-1", "type": "Dual Channel Receiver - Channel 1", "assignedZones": [{"name": "TOWER HOUSE"}], "state": {"outputOnOff": true}}
{"id": "3-2", "type": "Dual Channel Receiver - Channel 2", "assignedZones": [{"name": "Boiler Hot Water"}], "state": {"outputOnOff": false}}

The "Smart Plugs" are identified as:

{"id": "19", "type": "Smart Plug", "assignedZones": [{"name": "SMART PLUG 1"}], "state": {"outputOnOff": false}}, 
{"id": "22", "type": "Smart Plug", "assignedZones": [{"name": "SMART PLUG 2"}], "state": {"outputOnOff": false}}, 

What is have not seen before are "Electric Switch":

{"id": "5", "type": "Electric Switch", "assignedZones": [{"name": "Elec Hot Water"}], "state": {"outputOnOff": false, "measuredTemperature": 50.20000076293945}}, 
{"id": "6", "type": "Electric Switch", "assignedZones": [{"name": "FAMILY"}], "state": {"outputOnOff": false}}, 
{"id": "7", "type": "Electric Switch", "assignedZones": [{"name": "KITCHEN & UTIL"}], "state": {"outputOnOff": false}}, 

I am unclear from your comments above what is and is not working. Please confirm:

  1. Your "Dual Channel Receiver" are working.
  2. Your "Smart Plug" are working.
  3. The issues are with the "Electric Switch".
  4. Are there any other issues?

I note that one of your electrical switches has a measured temperature. Did this used be to displayed in HA?

Gowah8 commented 7 months ago

GeoffAtHome Dual Channel Receiver working Smart Plugs working Electric switches working in the Genius Hub app but not available in Home Assistant

Attached is a listing of all Genius Hub entities in my Home Assistant. Ignore Smart Plug 19 and Smart Plug 22. These are superseded entries, they now appear as switch_smart_plug_1 and switch_smart_plug_2

However, note that binary_sensor.electric_switch_5, binary_sensor.electric_switch_6 and binary_sensor.electric_switch_7 are no longer provided by the Genius Hub integration - up to late 2023 these entities were available. (note: binary_sensor.electric_switch_7 does not appear in the attached listing as I deleted it in Home Assistant in the hope it would return on reboot - it did not !). Switch 5 controls (on/off) the electric immersion heater in the hot water tank. It has a physical sensor attached that provides the temperature. Switches 6 and 7 each operate a zone valve (on/off) to control water flow into a separate zone in my wet underfloor heating.

On Sat, 20 Apr 2024 at 12:11, GeoffAtHome @.***> wrote:

@Gowah8 https://github.com/Gowah8 thanks for supplying devices.txt. I see that you have eight 'switches' (devices that support on/off).

Binary sensors are set is the type contains "Receiver". For you this is:

{"id": "3", "type": "Dual Channel Receiver", "assignedZones": [{"name": null}], "state": {"outputOnOff": true}}, {"id": "3-1", "type": "Dual Channel Receiver - Channel 1", "assignedZones": [{"name": "TOWER HOUSE"}], "state": {"outputOnOff": true}} {"id": "3-2", "type": "Dual Channel Receiver - Channel 2", "assignedZones": [{"name": "Boiler Hot Water"}], "state": {"outputOnOff": false}}

The "Smart Plugs" are identified as:

{"id": "19", "type": "Smart Plug", "assignedZones": [{"name": "SMART PLUG 1"}], "state": {"outputOnOff": false}}, {"id": "22", "type": "Smart Plug", "assignedZones": [{"name": "SMART PLUG 2"}], "state": {"outputOnOff": false}},

What is have not seen before are "Electric Switch":

{"id": "5", "type": "Electric Switch", "assignedZones": [{"name": "Elec Hot Water"}], "state": {"outputOnOff": false, "measuredTemperature": 50.20000076293945}}, {"id": "6", "type": "Electric Switch", "assignedZones": [{"name": "FAMILY"}], "state": {"outputOnOff": false}}, {"id": "7", "type": "Electric Switch", "assignedZones": [{"name": "KITCHEN & UTIL"}], "state": {"outputOnOff": false}},

I am unclear from your comments above what is and is not working. Please confirm:

  1. Your "Dual Channel Receiver" are working.
  2. Your "Smart Plug" are working.
  3. The issues are with the "Electric Switch".
  4. Are there any other issues?

I note that one of your electrical switches has a measured temperature. Did this used be to displayed in HA?

— Reply to this email directly, view it on GitHub https://github.com/home-assistant/core/issues/103195#issuecomment-2067641166, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARPTGQFD6G3J5Y52A5POOS3Y6JEN3AVCNFSM6AAAAAA6ZYZDZKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANRXGY2DCMJWGY . You are receiving this because you were mentioned.Message ID: @.***>

GeoffAtHome commented 7 months ago

I am a little confused at the moment. I need to do my research about "Electric Switch". This is eluding me at the moment.

It is probably directly related to changing "Smart Plugs" into switches rather than just binary sensors. But I cannot see beyond that at the moment.

GeoffAtHome commented 7 months ago

OK - I can see what has happened. "Smart Plugs" must be in their own zone and the zone type must be "on / off". The electric switches can be in a zone with one or more devices and the zone type is "hot water temperature".

Now that I can see the problem need to think about a solution.

Gowah8 commented 4 months ago

GeoffAtHome Any likelihood of a solution to the missing binary sensor entities for the Genius Hub electric switches ?

GeoffAtHome commented 4 months ago

Will gladly make the necessary change but currently trying to get a different PR completed.

The delay is with me and the reviewer that has been compounded with exams and holidays... I am still travelling.

GeoffAtHome commented 3 months ago

@Gowah8 , @RogerSelwyn I have make a change so that a switch is only a switch if appears in a zone on its own otherwise it is treated as a binary sensor.

I have created this PR which I hope closes this issue: https://github.com/home-assistant/core/pull/123077

RogerSelwyn commented 3 months ago

Just to confirm, how do I tell if the zone is scheduled on in Timer mode rather being put into than Override mode from the zone being in Off mode. To my eyes, these are two different ‘on’ states, because what happens at the end of the schedule or override is different. Scheduled on returns to scheduled off after override and will likely schedule on again. Overridden from Off mode will return to Off mode and will need manual interaction to come on again.

Maybe it doesn’t really matter, but the behaviour is different in each case and I still believe detail is lost with the changes you have made.

It is likely that you will still disagree with that view point, so I will stay quiet from the ongoing discussion.

GeoffAtHome commented 3 months ago

Hi Roger,

I agree with your comments. A switch can be in one of three states - off, timer or override. It can also be in a linked state so I guess could also be put into Away or Footprint mode.

I have only confirmed the Linked state.

Looking at the code when turning the switch on it always sets it to ZONE_MODE.Boost for right or wrong. I believe there should be a better way of GH switches in HA to changing the mode and duration and if the next time interval as necessary.

That said, this is not what this PR is about. It is simply trying to address this issue (plug status no longer visible as binary_sensor).

Taking on how to set the mode of the switch is going to be more difficult and not for today.

The actual state (on/off) of the switch is reflected in the UI as it is the GH hub true status that is reflected in the HA UI. Which is why sometimes there is a lag...

RogerSelwyn commented 3 months ago

I opened this issue, and this does not close the issue I raised which in essence was about the load of detail. It may have morphed to be something else due to another issue, but I don’t have the equipment that @Gowah8 has, so can’t validate if that is resolved.

GeoffAtHome commented 3 months ago

@RogerSelwyn, you are right, your issue was high jacked.

I would like to align our views here and if necessary make the necessary code changes.

From my stand point a GH switch is either smart plug, electric switch or receiver.

If a GH switch is alone in a zone it should behaviour differently to when it is not alone in a zone.

When alone in a zone it should be presented in HA only as a switch.

When not alone in a zone it should be presented in HA only as a binary sensor.

How would you like a GH switch to be presented in HA?

RogerSelwyn commented 3 months ago

I want to give you a considered response and I’m out for the weekend. So I’ll try and respond tomorrow afternoon or Monday.

GeoffAtHome commented 3 months ago

No worries. Enjoy your weekend. I need to update to code for the 'linked' case, when a GH hub switch is actually part of another zone.

RogerSelwyn commented 3 months ago

Just as a way recording my tests using the current code base, this is what I have tested. My starting point is a Genius Smart Plug allocated to a dedicated zone:

These all done from Genius App:

  1. OK - Off Mode - Shows as State Off and Mode shows as 'Off'
  2. OK - Off mode Override - Shows as State On and Mode shows as override, with duration on 1 hour (counting down), set point true
  3. OK - Override Off from step 2 - Shows as State Off and Mode shows as override, with duration on 1 hour (counting down), set point false
  4. (Not) OK - Timer Mode On - Shows as State On and Mode shows as timer. Duration still counting, but I suspect that is invalid data coming from GH. Setpoint false
  5. (Not) OK - Timer Mode Off - Shows as State Off and Mode shows as timer. Duration still counting, but I suspect that is invalid data coming from GH. Setpoint false
  6. OK - Timer mode Off Override On - Shows as State On and Mode shows as override, with duration on 1 hour (counting down), set point true
  7. OK - Override Off from step 6 - Shows as State Off and Mode shows as override, with duration on 1 hour (counting down), set point false
  8. OK - Timer mode On Override Off - Shows as State Off and Mode shows as override, with duration on 1 hour (counting down), set point false
  9. OK - Override On from step 8 - Shows as State On and Mode shows as override, with duration on 1 hour (counting down), set point true

The challenge with these is that you can tell 2 from 6 or 3 from 7 via the existing switch sensor (and you could not tell with the old code base either, so the change makes it no worse). 2 and 3 will return to Off at the end of the override, 6 and 7 will return to Timer. The Genius app tells you in the GUI which it will return to, but this is not presented on the switch entity at all.

If I make changes from HA:

  1. OK - As above
  2. OK - Off mode turn switch on - Shows as State On and Mode shows as override, with duration on 1 hour (counting down), set point true
  3. Not OK - Switch off from step 2 - Shows as State Off and Mode shows as timer (timer is currently scheduled off) , with duration on 1 hour (counting down), set point true
  4. (Not) OK - Timer Mode On - Shows as State On and Mode shows as timer. Duration still counting, but I suspect that is invalid data coming from GH. Setpoint true
  5. (Not) OK - Timer Mode Off - Shows as State Off and Mode shows as timer. Duration still counting, but I suspect that is invalid data coming from GH. Setpoint false
  6. OK - Timer mode Off Switch On - Shows as State On and Mode shows as override, with duration on 1 hour (counting down), set point true
  7. (Not) OK - Switch off from step 6 - Shows as State Off and Mode shows as timer, with duration on 1 hour (counting down), set point true
  8. Not OK - Timer mode On Switch Off - Nothing changes except the switch shows grey but says On at the stop
  9. ???? - Switch off from step 8 - Not sure what to expect here given that 8 didn't do anything

I would expect the second set to mimic the first set, given that the first set is the Genius App controlling. HA 3 is returning to the wrong state, probably because of the issue I pointed out above, it doesn't know what mode to return it to. HA 8 should be overriding the schedule on period to off, it didn't do anything.

So to my original issue, arguably the data is their because the function of the binary_sensor is shown in the mode attribute of the switch, with I think more info since it shows Off/Timer/Override, rather than the binary_sensor show override on/off.

But the testing shows that there are other issues where the HA switch does not do what it should do. I suspect it should be raised as a separate issue, such that this one can be closed. It has to be said, I haven't gone through the second set using the old code base, it maybe the results would be different, but I don't think that would help here.

Hopefully this helps.

GeoffAtHome commented 3 months ago

@RogerSelwyn many thanks for this detailed report. This is certainly food for though. I had only being looking at the state of the entity and not all the attributes. I need to track down where these are set and where these are not set.

From a pure communication with the hub I had always seen the hub reporting the correct state of the switch. This could be in the HA integration or the GH client library. This needs to be tested and validate.

What I am currently trying to do is to get to grips with adding tests to the integration. This way I could actually do some TDD and write the tests before fixing the code. Should help with development and stop introducing breaking changes. This does of course assuming the tests are valid.

issue-triage-workflows[bot] commented 3 weeks ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

Gowah8 commented 2 weeks ago

My problem with no electric switch entities in Home Assistant still exists at 202410.4. Screen shot of my Genius Hub shows the electric switches (these are not plugs) These Electric Switches are add-ons to the Genius Hub to wirelessly control a plumbed zone, wet underfloor heating zone or electric heater. GENIUS HUB

ELECTRIC SWITCH

As stated in my original post, these also used to appear as switches in Home Assistant but no more. The only switch entities now in Home Assistant are related to smart plugs.