dave-code-ruiz / uhomeuponor

Custom Component to connect Home Assistant with Uhome Uponor Smatrix App
MIT License
19 stars 7 forks source link

Can you take care fo the Uponor Smatrix Pulse project from @asev?? #35

Closed marcospg75 closed 2 months ago

marcospg75 commented 3 months ago

Sorry for coming here with issues from another project but I'm really desesperated 🈂️

It seems that asev is no longer mantain the new Uponor Smatrix Pulse, so I wonder if you can keep it under manteinance. I can collaborate with all the information you need and test it in my environment.

Now I get this error:

No se pudo llamar al servicio climate/set_temperature. Detected that custom integration 'uponor' calls async_dispatcher_send from a thread other than the event loop, which may cause Home Assistant to crash or data to corrupt. For more information, see https://developers.home-assistant.io/docs/asyncio_thread_safety/#async_dispatcher_send at custom_components/uponor/init.py, line 156: async_dispatcher_send(self._hass, SIGNAL_UPONOR_STATE_UPDATE). Please report it to the author of the 'uponor' custom integration.

Best Regards!!

dave-code-ruiz commented 2 months ago

only if you control HA enviroment and can edit files i can help you because it is hard create code without feedbacks and error logs that show me how to change your code.

first , in your enviroment you can go to line 156 in ha code config/custom_components/uponor/init.py file and comment this line , restart HA and show me new log, this line only update state , not is strict needed.

you can comment all lines similar in the file init.py, to comment line use #

async_dispatcher_send(self._hass, SIGNAL_UPONOR_STATE_UPDATE)"

dave-code-ruiz commented 2 months ago

Finally you need to convert all functions to async functions like in my code, you can see my last changes here:

https://github.com/dave-code-ruiz/uhomeuponor/commit/f626ed7e7050c0b116c74810eea723502087fd52

i think that with this changes it is not needed call function async_dispatcher_send

good luck , you can post results here

dave-code-ruiz commented 2 months ago

An example, you need to delete function :

def set_setpoint(self, thermostat, temp):
        var = thermostat + '_setpoint'
        setpoint = int(temp * 18 + self.get_active_setback(thermostat, temp) + 320)
        self._client.send_data({var: setpoint})
        self._data[var] = setpoint
        async_dispatcher_send(self._hass, SIGNAL_UPONOR_STATE_UPDATE)

and create instead:

async def set_setpoint(self, thermostat, temp):
        var = thermostat + '_setpoint'
        setpoint = int(temp * 18 + self.get_active_setback(thermostat, temp) + 320)
        await self._hass.async_add_executor_job(lambda: self._client.send_data({var: setpoint}))
        self._data[var] = setpoint
marcospg75 commented 2 months ago

only if you control HA enviroment and can edit files i can help you because it is hard create code without feedbacks and error logs that show me how to change your code.

first , in your enviroment you can go to line 156 in ha code config/custom_components/uponor/init.py file and comment this line , restart HA and show me new log, this line only update state , not is strict needed.

you can comment all lines similar in the file init.py, to comment line use # # async_dispatcher_send(self._hass, SIGNAL_UPONOR_STATE_UPDATE)"

Sure!!! of course I willl do all the changes and tests... Mil gracias!!! :)

dave-code-ruiz commented 2 months ago

https://github.com/asev/homeassistant-uponor/pull/45

issue resolved

Thanks @marcospg75 , un placer colaborar!!