-
Notifications
You must be signed in to change notification settings - Fork 39
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
Preset support #27
Comments
Hello, that is interesting idea, I think this could be done. (I am using presets heavily in other climate integrations) Just to fully understand it, could you please write use case? i.e. how it should work for user? Thank you. |
Thank you for quick and positive respons. My AC/heatpump have a eco-mode and hi-power-mode. These are custom hvac modes that, according to the ha docs for climate entity, are preset modes. To describe how one of these modes work; when hi-power-mode heating and cooling is faster but also more power demanding. Eco-mode is the opposite. In the cold winter here in Norway I use hi-power-mode a lot, but its not possible from ha, only original remote control. For me as a user it works as dedicated "on/off" buttons on the remote. In ha it probably should be availible as aditional presets/modes I think. I will have to record all the aditional remote ir codes for this to work and update my custom json code file. Maybe take a look at this post: smartHomeHub#709 and example of json codes file with eco preset mode: https://github.com/smartHomeHub/SmartIR/blob/39e4bf4b3f6219af9e06837eddeff8f167f81936/codes/climate/1162.json |
Ok, so your proposal is to overcome HA limit of hardwired (not customizable/extendable list of HVAC modes), by using preset modes. Preset modes are completely customizable, you can define them as you like.
Is this understanding correct? |
Yes, exactly. Default preset would probably be "none". I understand this is how, or at least one way, ha climate entity with presets is supposed to work as described here : https://developers.home-assistant.io/docs/core/entity/climate/. |
There is another way of using preset modes and it is to use them as profiles. In this way by activating given preset you can in one click set combination of the hvac mode, fan mode, swing_mode and temperature. This seems to be also the way, how the presets are used in fan entity. I would like to provide presets for the both climate and fan entity in coherent way. So any thoughts on how to implement it are welcome. ;-) |
Hi, I've studied myAC/heatpump docs and found that eco and hi-power actually is working according to your description of profiles. For instance is hi-power in heat mode incressing the the temperature setting by two degrees and sending the airflow downwards. I think I don't need presets😊 This could be done with an automation, a script or a scene. I suggest to close the issue. |
Hello, thank you for the info. Actually I would probably go to implement presets at some time, as those are really useful to overcome HA limits caused by hardcoded list of hvac_modes. I just need to think about it a bit more. One way how to implement those is as we described - as another layer of the device data codes. The other usage - to used those as profiles - I am not sure if this will works, as HVAC always sent whole setting as a one command. So without possibility to link your script or scene towards one code via SmartIR you want be able to set your HVAC device... So please let me know and reopen this issue - as I am mentioned I am willing to implement presets anyway, ;-) |
Thank you! I think a another layer of device codes is the most intuitive use of presets, and a good approach to overcome the hardcoded list of hvac_codes in HA. I already have the device codes recorder for eco and hi-power, but I'm not able to utilize them. Instead I have an automation to circumvent this. I have a helper for the desired temperature, an IR-controller and indoor and outdoor temperature sensors. The automation is adjusting the HVAC mode and fan speed automaticly based on the season, outside temperature, and indoor temperature. To mimic hi-power:
If SmartIR had preset support my automation would have been a lot easier than it is now. I also think that my AC/heatpump maybe working somewhat different when Hi-power is enabled on the remote. |
Thank you for the discussion and information provided. I will think about the best way ho to implement this also for fan modes, but so far I think that implementation described here is the way forward. Please give me some time, as I am now trying to release version with many bugfixes and other wanted feature, so I will postpone my work on this for few days. I will then prepare for you branch with preset modes implemented and ask you for testing, as my AC is don't have any features allowing to test preset. |
I think profiles as you describe it is more like rememberred settings, like "my comfort" or "away" with a fixed temperature, fan-speed, swing mode and HVAC mode. My AC/heatpump also has functions for this. I just press a memo button to remember the current settings and a "my comfort" to activate the remembered setting. I've never used scenes, but it sounds to me that I could have used scenes to mimic profiles. |
Thank for taking the time to discuss this with me. I will for sure test this as soon as posible when you have prepared it. |
So the intial support for preset modes is now in. Please replace climate.py in your HA instalation by one form here You will need to provide modified device data json in the format as we discussed:
Please put your modified json file into custom_codes/climate folder. Then restart HA a you are free to test. ;-) Report any bugs to this thread, thank you. |
Thank you, I will test it the next couple of days. I just have one question. Is "none" also a preset in the structure or does your code handle that preset is not provided for the default one? |
You are welcome, looking forward to the test results. regarding preset, there is no HA limitation on the integration (to my knoweldge) on hadling presets. Therefore the rule I implemented is:
so there i no special preset 'none' or or no present set, handled differently. I probably caused confusion by naming that first one 'none', feel free to name it 'litinoveweedle' or any name you like. ;-) |
Hi, I've altered my device codes file, replaced climate.py, and done some testing. Presets are working and it seems to me that the device codes are sent correctly. Well done! Som adjustments probably needs to be done:
I have a suggestion for the structure of the device codes file. To me it would make more sense having presets as the top-level and to make it optional: In this way you can preserve all old device code files, and add/append presets if you like. |
Hello, thank you for testing.
The example you linked is not much usable right now, as for many different reasons the way how the climate codes in send_command are handled now is completely different to the original SmartIR. As I mentioned please give me day or two, I will try to think about it. I will come back to you with another preview soon. Thank you so far for help and cooperation. |
I was considering updating the SmartIR code to meet the latest Home Assistant requirements when I discovered your repository. I'm so glad to see that someone has taken on this task! I haven't had a chance to read through your code yet, but from what I recall, Home Assistant does require significant changes to accommodate the new climate interaction methods. In any case, I'm excited about the prospect of using presets with a well-maintained integration, as I've been relying on my own fork for quite some time. Thank you for your hard work on this! |
Hey, you are very welcome and thank you for kind words. I use this repo as well for my own AC control, so it is in my own interested to have working integration. The key is to have community around to help. with bug reports, testing and pull request. The problem with the original repository was, that the maintainer stopped accepting PR long time ago. But this is beauty of FOSS, anyone can fork and try to keep wheels spinning (at least for little while) ;-) So give a star and stay connected. ;-) |
@ehedlund76 hello and sorry for slight delay. I was hopefully able to fix most of the reported issues. I make the whole data file hopefully more versatile. When searching for any given IR command each level (hvac mode, preset mode, fan mode, swing mode, temperature) is searched by same mechanism:
If catch all key is used, than given value (mode, temp) attribute is not internally set/changed. So when going back to tree in which original key exists previous value is used. based on this you can choose how you would like to implement preset mode when it is not supported by given hvac mode:
I tested it rather quick (but without presets) and it seems to be still backwards compatible... I would welcome your feedback. |
Hi @litinoveweedle |
Hello I just checked both of your files and there are not in a valid format. the format is still hvac_mode->preset_mode->fan_mode->swing_mode->temperature. in case that given hvac_mode doesn't support any preset mode, you can you "-" as preset mode name. Or you can define preset mode "none" and use it as a default preset mode for all hvac modes. (it will be default, when it will be listed as first in the preset_modes list. |
Ok, my bad. I thought we concluded on switching the order of presets and hvac modes in the structure😊 I'll get back to testing. |
I explore that possibility as well, but rather decided to keep it the same way so far. |
I've adjusted the format of my device codes files in two alternate ways, and done some testing. So far I've focused on the UX behaviour, and haven't checked if the correct IR-signales are sent. Config. 1: With a defined preset mode "none" as first mode in the preset list, and then used as default mode for all hvac modes Config. 2: Without a defined preset mode "none", and then used "-" as key on hvac modes that doesn't support presets |
Hi @litinoveweedle |
Hello @ehedlund76 , thank you for thorough testing. Regarding your findings: Config1 Config2: I will be off as well until beginning of the next week, so no worries, take your time and thank you once more for testing. |
I don't know how most ac types work when changing hvac mode, but mine is reverting back to no preset, for instance when switching from cooling to heating. That makes sense to me. For instance when its hot in the summer I turn on hi-power cooling, sometimes at night it gets cold and I switch to heating. I'm not expecting hi-power heating to be enabled by default. My ac always default to no preset when switching hvac mode. But then again, I'm not sure if this normal behaviour for an AC. I guess it's a design choice. I've tested different combinations of fanmodes and hvac modes, and am quit embarrassed to say that I must have reported this error by mistake. I'm not able to reproduce it. I'm sorry to have lead you astray. |
Hello, There are two possibilities how to fix it
Regarding the supposed fan modes and hvac modes issue - no worries and thank you for testing, I am glad that this issue is gone for good. ;-) |
Hi I will adapt my automations to handle hvac changes and presets accordingly. Thank you for providing this functionality! |
Hello, thank you very much for kind words and especially for the detailed testing! If you agree I would merge this branch with master and release it in the next release. I will also need to amend json data files documentation (or better create it, as it is currently non existent). I will keep this topic open, until I will release the version with the preset support. If you find any related issue please let me know. |
Sure, I'd really appreciate preset support in the master branch. I've attached my device codes file for my Toshiba AC with all supported HVAC modes and presets. It could be included in the master branch as well if you like. |
Hello @ehedlund76 there was recently issue reported with the #47 Fahrenheit support. To fix it I extended considerably our development branch. Would you be please so kind and retest it if it is still working with your setup? Please note:
I am sorry for this late request, but I would like to release preset support but now I am not fully sure it will be working... Thank you for your help. Update, I just check your attached data files, and it is passing added syntax check ok, so just functional test is needed. Thank you |
Hi Of course, I'll set it up for testing first thing tomorrow. I'm happy to help! |
I'm happy to report that all is working as ut should. In addition to my two "production" devices I've added a dummy devices to test with no presets with this branch. Well done! I noticed you have corrected issue #35 I reported earlier. Thank you. Could you review my last comment in #35 about dry mode as well? |
Thank you for spotting this! I added this into preset branch as well. I just merged preset branch into master, including your submitted device file as now 1266.json. Thank you very much for massive preset support will be release in the next release. I still need to create documentation for the climate json format including the preset mode. ;-o |
Hi again Thank you so much for your superb work! I didn't find 1266.json in the master or preset branch, but was able to locate it in the code_checking branch. Anyways; When you're updating the codes list I've been using a Tuya Zigbee IR blaster (ZS06) for my setup. |
Sorry you are correct, I will merge it as well. Regarding that comment about the Tuya remote, is any change in the file required? I don't fully get it, sorry. |
No changes needed. It was just for the name of the controller with the json file in the table of climate codes. |
That table is now generated automatically from the content of the all valid code files. I always wanted to automate this stuff. So the controller is taken directly from the file. So the question is if we need additional field describing exact remote type. |
Ah, I understand. I think the supportedController field covers what is needed, for instance ZHA in my case. It probably isn't needed to know the exact remote. |
Yep, I have same understanding, those codes shall be hopefully generic. |
I suggest to close this "issue" now. It is running without any errors, and is functioning as expected. Erik |
Hello @ehedlund76 , I would like to release this in the release, but I think that users deserve some documentation. Would you be please so kind and propose some documentation for the new Climate format? I promise to review it and include in the release. Thank you. |
Ok, I added some initial docs for extended climate format. I am closing this now. Thank you again for the help with all the testing. Feature is now included in the latest beta and will be released soon. |
Hi
Could you please consider adding support for presets to this excellent form of SmartIR?
Look at this fork for inspiration: https://github.com/Zen3515/SmartIR/tree/support-preset-modes
The text was updated successfully, but these errors were encountered: