NigelCoxon / Hass-heatmiser

Home Assistant Component for Heatmiser PRT-N Stats
7 stars 2 forks source link

HVAC modes not added/Unable to control PRT hvac_mode from HA #5

Closed accomco closed 3 years ago

accomco commented 3 years ago

Firstly @NigelCoxon can I thank you for taking the time to create this; it works a treat on integrating our decade-old PRT network into HA via an RS485 converter, unlike the built-in integration!

My issue - really a question - is whether it should be possible to control the hvac_mode from HA for each climate entity created by the component? At present, no hvac_modes are available in any of the climate entities created via heatmiser_ndc.

Changing the set-point temperature works both ways (PRT->HA and HA->PRT). So far, so good.

Meanwhile, changing the hvac_mode via the PRTs themselves reflects perfectly in HA (with the thermostats either being in 'Auto' or 'Off'). In the other direction, trying to change the hvac_mode of a climate entity created via heatmiser_ndc results in an error that 'set_frost_protect_mode' is unavailable. Any ideas?

NigelCoxon commented 3 years ago

Hi @accomco , I'm pleased you are finding it useful. Until, you reported this, I hadn't tried changing the hvac_mode. I've just tried to do this from the UI, and there doesn't seem to be any way to do this. How did you try to change it? By calling a service?

I have had a very quick look at the code (as I haven't touched it for many months), and there are odd bits of code (inherited from the original) that look a bit strange.. I'll investigate and see what I can do.

accomco commented 3 years ago

Hi @NigelCoxon, many thanks for the swift reply! So, to try this out, I added the relevant hvac_modes of 'Heat' and 'Auto' to a climate entity created via heatmiser_ndc by using the HA Customisations function. Once added (in JSON) the modes then happily appear on the Lovelace dashboard; I then attempted to call them via the 'climate.set_hvac_mode service'. Once called, the service reports the error that 'set_frost_protect_mode' is unavailable.

Of interest - there is successful bi-directional communication with the PRT thermostats so far as the set point is concerned, but hvac_mode only works one-way (PRT->HA) - I wonder if perhaps when the component creates the climate entity, the correct hvac_modes are not set up?

By the way, the official HA heatmiser component seems to incorrectly register MODBUS output to the various attributes within the created climate entity (or entities), however, it does set up the hvac_modes within them.

NigelCoxon commented 3 years ago

I have tried turning one of my stats off, by using the services in the Developer Tools section of the UI. This causes an error. It looks like I was over zealous in simplifying the original code. I should be able to reinstate hvac_modes in the same way as the official code did (supporting modes "heat" and "off") The services "turn_on" and "turn_off" should then work properly. "off" will be interpreted as running the PRT in frost protect mode. No guarantees on the timescale for fixing this, but I'll have a go in the coming week.

I'd be interested to understand what you are trying to achieve with the hvac modes- it might help me get it working for you.

accomco commented 3 years ago

This is really helpful, thank you!

The simple answer to your last point is that we have 16 PRTs in a configuration very similar to yours. When certain rooms are unused, say for example the spare room, we put them in frost protect mode.

The longer answer is that over the last year I have been working on automating the whole property. Heating and DHW is provided by a Nibe F1145 GSHP, which I've integrated with HA using another excellent component (hass_nibe). The GSHP previously worked solely by calculating the required UFH temperature based on an amalgam including the outside temperature trend. Using Nibe's 'Nibe Uplink' system, I have now established direct communication of actual thermostat temperatures between the GSHP and HA - and your plugin allows me to create virtual 'zones' based on averaging the outputs of groups of PRTs to feed into that mix. Nibe Uplink uses these data to adjust its curve and better match the heating need.

Clearly, if too many PRTs have 'inadvertently' been placed manually into frost protect mode, the UFH is going to have a hard time in maintaining a comfortable temperature, hence me looking to be able to switch them back to 'Auto' from 'Off' programatically. I hope that gives you a fuller explanation!

Very willing to test out anything you produce on our setup - and thanks again!

NigelCoxon commented 3 years ago

Hi Thats really interesting. We have lots of rooms that we rarely use, and I've been looking at trying to control the PRT comfort levels from HA but the PRT capabilities don't map onto HA climate components at all well. Turning the stats into frost protect mode could work for me well. I'd probably set the frost temp to 12-14C. That gives me an incentive to get the code working!

We too have a GSHP, a Kensa, installed back in 2009. Unfortunately there's no app and no way of interfacing to it, so the only control is on/off via a smart switch

NigelCoxon commented 3 years ago

I'm new to Github, but I've created a new branch called Added Hvac modes ..... This implements the hvac modes as the original component did. Tested on my own system, and I can turn the stats on and off OK - either from Developer Tool Services or from the UI

Please try it and let me know how it goes. Ill update the main branch if it works OK for you

accomco commented 3 years ago

Hello. Thanks ever so much for doing this. As soon as I installed the test branch, hey presto, up came hvac_modes in the UI:

Screenshot 2021-10-31 at 17 00 02

If I could make one suggestion, it would be to automatically add the hvac_mode of 'auto' as well as 'heat' and 'off' for each climate entity created - I have done this via customisations for the 'Kitchen' zone in the image above as a working demo. In testing, when in hvac_mode 'off' the user can click on the 'auto' icon in the UI and the stat goes green as it should; likewise when calling for heat, the stat turns orange and highlights the 'heat' icon below.

Otherwise, I'm very grateful for you having done this work; noting your engagement with the HA team in 2019 - yours should really replace the official HA component!

NigelCoxon commented 3 years ago

Good idea. Ive updated the branch, so please give it a try.

I have thought about trying to become the official component, but there's quite a bit to learn about HA and Pypi as well, so for the moment, I'll stick to the custom component

accomco commented 3 years ago

Works a treat! I suggest merging the latest branch with 'main' such that HACS can keep track. I shall mark the issue as closed; thank you again for being so helpful.

NigelCoxon commented 3 years ago

@accomco I've created a new branch (try out humidity / frost protect) which allows the frost protect temperature to be read and written by pretending its the humidity setting supported by the standard climate component. This works well for me, please give it a go, and check it out if you can.

I am now managing my heating by turning stats on/off, and being able to see and change the frost protect temp helps

Heating card

accomco commented 3 years ago

@NigelCoxon sorry for the delay! Let me try that out.

accomco commented 2 years ago

@NigelCoxon again sorry for the delay; was struck down by whatever's going around. In good news however I've had your component on extended test and can report excellent service. Noting how you manage your system (in your previous post) an alternative would of course be to create a script to call the climate.set_temperature service for all the thermostats you want to put into a 'frost protect' state, setting a lower target temperature (clearly you'd need a second script to reverse the action). Of course, just turning them off with climate.set_hvac_mode and then relying on the frost protect temp set in the PRTs (or via your humidity workaround) has the benefit of fallback-robustness. Many thanks again for your really useful work.

NigelCoxon commented 2 years ago

@accomco Glad it works for you. I've been trying out the turn off method for rooms I dont use, which is working well, and is pretty simple. This is what I'll use going forward. I've also been working on extracting all the other thermostat variables including comfort levels, which is now working well for me. These are written to additional state attributes. I'll try and upload this to a Github branch tonight. Please try if you're interested.

Next step will to provide services to change the r/w variables. I don't think this is very difficult, but I'll have to see how much time I have before Xmas