MindrustUK / Heatmiser-for-home-assistant

Heatmiser Neo-Hub / Neostat support for home-assistant.io
88 stars 32 forks source link

Turning switch on from Home Assistant #113

Closed PhillyGilly closed 1 month ago

PhillyGilly commented 1 year ago

I'm probably missing something really obvious but..... I want to turn on and off a heatmiser neo-HW using an automation in HA. I set up a profile in the heatmiser app which has a name but no ON or OFF times set, then I a simple test automation in HA:

description: ""
trigger:
  - platform: time
    at: "10:00:00"
    id: towel1_1
condition: []
action:
  - choose:
      - conditions:
          - condition: trigger
            id: towel1_1
        sequence:
          - service: switch.turn_on
            data: {}
            target:
              entity_id:
                - switch.towel_rail_1
          - delay:
              hours: 1
              minutes: 0
              seconds: 0
              milliseconds: 0
          - service: switch.turn_off
            data: {}
            target:
              entity_id: switch.towel_rail_1

What happens is that the switch status in HA updates but the status in the Heatmiser App remains the same then after a short while then goes off again. Any help appreciated.

ribbal commented 1 year ago

Hmmmm…….this works for me (though I’m not using any profiles). If you manually flick the switch on the HA dashboard, does the status update in the Heatmiser app?

PhillyGilly commented 1 year ago

If I operate the switch on my HA dashboard, it changes the state shown in the app for about 60secs before it switched off again.

ribbal commented 1 year ago

Hmmmm……this works as expected for me. Are you running the very latest version of the Heatmiser integration?

PhillyGilly commented 1 year ago

Yes, as far as I know. Was this a recent change? I'll have to check/confirm later.

ribbal commented 1 year ago

No, I don't believe there have been any recent changes.

PhillyGilly commented 1 year ago

@ribbal I looked in HACS but couldn't see what version I am running. I ran the package update and the number here doesn't change. Does this mean I am on the latest? image

ribbal commented 1 year ago

Yes, you are on the latest version.

petitpiton commented 1 year ago

I have a similar problem. I have an automation to control the Neo for Hot Water (Gas Boiler). The automation triggers when the temperature of the tank drops below a threshold level and switches the Hot Water on. It was working as expected until recently. Now, the automation switches the hot water on, but 30 seconds later the switch reverts to off (no HA service tagged as having done this), so the automation triggers again and 30 seconds later the hot water switches itself off again, and so on. I haven't made any changes to the automation and have only applied core updates to HA (2023.2.5 currently). Screenshot to show the behaviour described above.

Screenshot 2023-02-21 at 10 28 35

Any ideas?

PhillyGilly commented 1 year ago

Just come back to this as I wanted to turn on my towel rails when there is excess solar PV power. It feels to me as though the action is just taking place in HA but never getting sent to the Heatmiser so the HA display shows the status based on the command but reverts to the actual Heatmiser status on the next scan. Just like yours @petitpiton:

Towel rail 1 turned off
20:21:55 - 24 seconds ago
Towel rail 1 turned on triggered by service switch.turn_on
20:21:28 - 1 minute ago
PhillyGilly commented 1 year ago

OK, I just found that I have some switches that have different "names" and "zone_names" and the and some duplicate names. I think this is due to re-using neo-stats about, so I am going to try to resolve that before re-visiting this thread.

coathook commented 1 year ago

Hi, I have a Neostat Air which is used for controlling the landing temperature, and the time switch function is used for hot water I see a similar issue, that Home Assistant turns the switch on, and then off again a few seconds later, and then on again. from the history:

image

is this to be expected?

Secondly the "On" command actually triggers the Neostat to switch on for 30mins (like a boost) so for 1 hr of hot water I trigger two 30min cycles. Is there any way to change the 30mins timeout from HA to e.g. 60mins? - that would be very helpful in a future update of the integration

DKen71 commented 1 year ago

I have a similar situation to @coathook second issue. I have two NeoStat units that act as switches to turn on electric towel radiators. I have set up automations to toggle these switches at a set time. The automation fires and turns the switch on. However, Heatmiser interprets this as a boost and sets the timer for 30 minutes, after which the switch toggles back off. I have looked at the Heatmiser Neo Climate: Temperature Hold On call service, but that only recognises climate entities within Heatmiser and not any switches within heatmiser. Is there a way to toggle this switch between standby and auto or to set the hold time, in the way that we can with climate entities.

petitpiton commented 1 year ago

@DKen71 If you’re comfortable editing python code, you can modify the switch.py file at around line 54:

    self._holdfor = 30

I changed this to 60 and now the boosts are for an hour. —————— Regards Dr David Johnson

On 8 Aug 2023, at 09:58, DKen71 @.***> wrote:

I have a similar situation to @coathook https://github.com/coathook second issue. I have two NeoStat units that act as switches to turn on electric towel radiators. I have set up automations to toggle these switches at a set time. The automation fires and turns the switch on. However, Heatmiser interprets this as a boost and sets the timer for 30 minutes, after which the switch toggles back off. I have looked at the Heatmiser Neo Climate: Temperature Hold On call service, but that only recognises climate entities within Heatmiser and not any switches within heatmiser. Is there a way to toggle this switch between standby and auto or to set the hold time, in the way that we can with climate entities.

— Reply to this email directly, view it on GitHub https://github.com/MindrustUK/Heatmiser-for-home-assistant/issues/113#issuecomment-1669207087, or unsubscribe https://github.com/notifications/unsubscribe-auth/APFVDMOY5KUERSA5M7GKL4TXUH5UFANCNFSM6AAAAAAR3UIZ4Q. You are receiving this because you were mentioned.

PhillyGilly commented 11 months ago

Hi, I have a Neostat Air which is used for controlling the landing temperature, and the time switch function is used for hot water I see a similar issue, that Home Assistant turns the switch on, and then off again a few seconds later, and then on again. from the history:

image

is this to be expected?

Secondly the "On" command actually triggers the Neostat to switch on for 30mins (like a boost) so for 1 hr of hot water I trigger two 30min cycles. Is there any way to change the 30mins timeout from HA to e.g. 60mins? - that would be very helpful in a future update of the integration

Could you explain “0n” command, pls?

bonkersbrains commented 8 months ago

I have the same problem (sort of), I switch the hot water on manually in HA and a few seconds later it switches off on its own. It isnt consistent though. I just did it, and 8 seconds later it turned off on its own. Then 1 minute 36 seconds later it turned itself back on again. Manually turning it off worked first time.

edit: I did some more testing after disabling the hubs' access to the cloud (via my router) and the same behaviour persists, so I am not sure why this is the case.

For now I have disabled this heatmiser plugin on HA and am just using the HomeKit approach because this seems to give a more consistent set of actions (turn on, its turns off, then it turns on).

I did find that my Switchbot Hub (either the USB adapter or the hub itself) was interfering with my RFv2 on the boiler. The switchbot hub was close to the boiler. Moving the switchbot hub resulted in consistent (albeit strange) behaviour. The other thing I may do is buy a new wifi system that lets me change the channel. According to Heatmiser if your 2.4Ghz wifi is using anything below channel 5 you will interfere. Annoyingly my Mercusys HG50 mesh network doesnt let me configure the channel.

MindrustUK commented 8 months ago

If you're using the current master branch you can find the logic for this behavior here:

https://github.com/MindrustUK/Heatmiser-for-home-assistant/blob/0d4905c022fca39c3b8134ece7246e3fabc00a84/custom_components/heatmiserneo/switch.py#L122

What's actually happening is that when you call "On" against a NeoStat operating in TimerClock mode (which is always the case with the Hot Water models as they don't support working as a thermostat), You're actually requesting the device go "On Hold" for X time. In the exiting code this is defined here: https://github.com/MindrustUK/Heatmiser-for-home-assistant/blob/0d4905c022fca39c3b8134ece7246e3fabc00a84/custom_components/heatmiserneo/switch.py#L54C9-L54C27 This is currently set at 30 minutes.

The reason this may change behavior is due profiles defined in Heatmiser's own application. Example: Home Assistant asserts a state then this is countermanded by internal / cloud logic on Heatmiser's Part.

There is a level of assumption on my part about the above. I personally run my system with NO profiles or use of the Heatmiser app other than setting temperatures where convenient and let Home Assistant retain control of everything.

Behavior is slightly different in the Development branch and makes some of this operation clearer, I'd start by deploying that and seeing how you get on. I'd also suggest clearing all profiles and running the system completely through Home Assistant to avoid complications.

MindrustUK commented 1 month ago

Closing, explanation provided. Further improvements underway in dev branch.