Closed somm15 closed 5 years ago
I git distracted from the project a little but I don't think there's too much that's blocking an integration into HA. I would like to understand the 504 issue when setting mode before creating a PR at Home Assistant. That currently makes the whole thing a little unstable. I'll look into that again once I find some time.
Any news about that ? Did you undertand and fix the 504 issue ? An official integration will be usefull ! (I have an unknow problem with 0.93.2 version of HASS)
Sorry to say that I didn't even start to create a PR yet. I've been quite busy with private stuff recently and find little time to make this happen. If you or anyone is interested to do the full HA integration feel free to do it. Otherwise I'll have to see when I find more time.
The 504 issue was resolved some time ago already. The custom component was not using the API correctly.
Also: If your heating is in standby mode the problems could be solved by this PR of @vandenberghev : https://github.com/oischinger/ha_vicare/pull/18 It was merged today.
Sorry to say that I didn't even start to create a PR yet. I've been quite busy with private stuff recently and find little time to make this happen. If you or anyone is interested to do the full HA integration feel free to do it. Otherwise I'll have to see when I find more time.
I'll see what I can do over the next few weeks. But please clarify: are you still committed to working on this project, or should I 'hard fork' and work from there?
If you're contributing to the HA source base it'll be a hard fork anyway.
Feel free to go on with this project as you want. I don't want to slow down development or integration just because I'm too busy right now.
Sorry it's been quiet for so long. I've been wanting to integrate this "officially" but I've been having some medical issues which severely limit my computer time... the required updates for 0.96 might finally give this the boost needed to get the job done :)
Integration into HA finally in progress: https://github.com/home-assistant/home-assistant/pull/26151 https://github.com/home-assistant/home-assistant.io/pull/10211
Great news !!! Thank you for the effort.
Sorry that I broke everything with the 0.1.0 version of PyViCare. Please let me know if you need help to migrate.
@somm15 I have one question which you probably can help me with. I'm getting a lot of json decoding errors when interacting with the API recently. All the commands seem to work fine but still there are these exceptions. E.g.
Expecting value: line 1 column 1 (char 0) Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 130, in handle_call_service connection.context(msg), File "/usr/src/homeassistant/homeassistant/core.py", line 1235, in async_call await asyncio.shield(self._execute_service(handler, service_call)) File "/usr/src/homeassistant/homeassistant/core.py", line 1260, in _execute_service await handler.func(service_call) File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 210, in handle_service self._platforms.values(), func, call, service_name, required_features File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 349, in entity_service_call future.result() # pop exception if have File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 371, in _handle_service_platform_call await getattr(entity, func)(**data) File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 415, in async_set_hvac_mode await self.hass.async_add_executor_job(self.set_hvac_mode, hvac_mode) File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run result = self.fn(*self.args, **self.kwargs) File "/config/custom_components/vicare/climate.py", line 184, in set_hvac_mode self._api.setMode(vicare_mode) File "/usr/local/lib/python3.7/site-packages/PyViCare/PyViCareDevice.py", line 54, in setMode r=self.service.setProperty("heating.circuits." + str(self.service.circuit) + ".operating.modes.active","setMode","{\"mode\":\""+mode+"\"}") File "/usr/local/lib/python3.7/site-packages/PyViCare/PyViCareService.py", line 229, in setProperty return self.__post(url,data) File "/usr/local/lib/python3.7/site-packages/PyViCare/PyViCareService.py", line 189, in __post r=j.json() File "/usr/local/lib/python3.7/site-packages/requests/models.py", line 897, in json return complexjson.loads(self.text, **kwargs) File "/usr/local/lib/python3.7/site-packages/simplejson/__init__.py", line 518, in loads return _default_decoder.decode(s) File "/usr/local/lib/python3.7/site-packages/simplejson/decoder.py", line 370, in decode obj, end = self.raw_decode(s) File "/usr/local/lib/python3.7/site-packages/simplejson/decoder.py", line 400, in raw_decode return self.scan_once(s, idx=_w(s, idx).end()) simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
Any ideas what's causing this? Empty return values? Should I catch this in the HA component?
@somm15 It's weird, even though you import json it seems to be using simplejson in the custom component. The exception occurs because the code catches json.errors.JSONDecodeError instead of simplejson.errors.JSONDecodeError
Indeed, it does use simplejson ... strange. I'm searching ...
I can't reproduce, on my system running just the test script, I don't get any error. I don't understand where this simplejson is coming from...
It appears that the request library falls uses simplejson if available and uses the default one only as a fallback. I don't have simplejson, so no error. I now have 2 options, be more clear in my import or make my code simplejson friendly...
It must be related to the environment provided by home assistant or in my case HassIO. All other HA components import json as well, no references of simplejson anywhere. I'll try to catch the exception with non-qualifed name and see what happens
This is the code in "requests": requests/compat.py try: import simplejson as json except ImportError: import json
Oh, weird.
I guess one could import json as simplejson or so. Not sure if that's very clean.
Anyway I guess we have to release a fix for the HA integration.
Some recent version of HA must have pulled simplejson. It didn't happen before
This is solved in version 0.1.1. It is rather ugly but they made me do it :'( I now test as well if simplejson is installed and adapt the import. Tested with and without simplejson installed.
Cool, thanks. I guess we're close to an official integration soon
Great ! That's a good team effort
Good job guys.
Off-topic, but whatever: any of you still having stability problems with the ViCare component? Recently, I have been unable to switch back to "Off" (aka ForcedReduced). Even the ViCare app itself couldn't do it, had to reset it on my thermometer. I wonder if the ViCare api changed, or if it's the Vicare component doing something it shouldn't...
BTW I'm happy we're moving the api client to a centralized one, I suspect that the multiple instantiations of the api client may be one of the factors that's breaking the component quite often (for me at least)
@vandenberghev: i haven't had any stability issues in the recent past anymore with the api. I believe the refactoring of the api didn't change the behavior.
But you're right. Setting up a central PyVicare instance shared with the water_heater and climate platform was good review input ;)
Good job guys.
Off-topic, but whatever: any of you still having stability problems with the ViCare component? Recently, I have been unable to switch back to "Off" (aka ForcedReduced). Even the ViCare app itself couldn't do it, had to reset it on my thermometer. I wonder if the ViCare api changed, or if it's the Vicare component doing something it shouldn't...
No issues for me neither with the refactored version. ViCare is running fine for the past weeks!
Weird... Are you both using hass.io? I'm running hass in a virtualenv on an Ubuntu VM.
I'm running ubuntu on top of LXD and no stability issue .
I'm running hassbian
@oischinger I just integrated the latest version, which is ready for HA. Seems to work like a charm, but I have a question: is there a way to add the outside temperature? As this is for me the only thing missing (for my usage anyway) on the vicare_heating
@geertmeersman I definitely want to add that (and some more data from the vicare API). It's probably gonna happen as attributes to the climate component instead of sensors. Fot the initial integration I didn't add that cause I wanted to keep the pr as minimal as possible. Once finally integrated I'll look into that.
@oischinger indeed I saw it already with the current_temperature! It is perfect for me, no sensors needed! I you want me to contribute, just shout!
@property
def device_state_attributes(self) -> Dict[str, Any]:
"""Return the device specific state attributes."""
data = {}
data["outside_temperature"] = self._api.getOutsideTemperature()
data["ActiveProgram"] = self._api.getActiveProgram()
data["ActiveMode"] = self._current_mode
data["HeatingCurveSlope"] = self._api.getHeatingCurveSlope()
data["HeatingCurveShift"] = self._api.getHeatingCurveShift()
return data
PR was merged. Thanks for the great collaboration on this thing. I guess I'll remove the code from this repository once the next HA release is out. We'll have to move further development to the HA source tree.
Good job all 😊 It’s nice to see the combined effort turn into something for all to enjoy.
No need to remove this repo, @oischinger; you’ll want to keep it around as reference or as a backup in case the implementation in the HA repo turns into something you don’t agree with.
Are you far away from integration in the official repository? It would be cool. Do you need any help?