gvigroux / hon

Support of all Haier, Candy, Hoover appliances integrated in the official hOn mobile app. Direct access to all possible services and parameters
MIT License
135 stars 51 forks source link

Washingmashine - 3 Sensors unknown status #36

Closed lovicub closed 1 year ago

lovicub commented 1 year ago

Hello, thanks for awesome work! i was able to integrade my washingmashine Haier HW90_B14959U1 (_DE)

3 sensors don't update properly, any suggestions? Speed, Temperature and Time Remaining (ignore last one "washing cycles")

image

LOG:

Logger: homeassistant Source: custom_components/hon/sensor.py:547 Integration: hOn First occurred: 17:00:41 (60 occurrences) Last logged: 17:30:11

Error doing job: Task exception was never retrieved Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 151, in _handle_refresh_interval await self._async_refresh(log_failures=True, scheduled=True) File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 283, in _async_refresh self.async_update_listeners() File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 110, in async_update_listeners update_callback() File "/config/custom_components/hon/sensor.py", line 547, in _handle_coordinator_update self._attr_native_value = int(json["spinSpeed"]["parNewVal"]) TypeError: string indices must be integers

ndom91 commented 1 year ago

@lovicub what did you do to get all that data?! I have the same washing machine model and just setup this integration for the firs time. It found my device, but only populated two entities - "Machine Mode" and "Time Remaining".

Also regarding your error, it looks like its a variable typing issue. I'm assuming it didn't have a spinSpeed.parNewVal in the response JSON and couldn't cast it into an int, maybe because there currently wasn't a load running?

I'm not very familiar with python, but theres got to be some sort of fallback value syntax like in JS, where we should fallback to 0 when no spinSpeed.parNewVal is sent along.

lovicub commented 1 year ago

Hey @ndom91 i've just looked at pull requests and added some changes to sensors.py and washingmashine.py Jst look at washing machine addition #13 -> Added new washing machine sensors

                HonWashingMachineCurrentElectricityUsed(hass, coordinator, entry, appliance),
                HonWashingMachineCurrentWaterUsed(hass, coordinator, entry, appliance),
                HonWashingMachineLastStatus(hass, coordinator, entry, appliance),
                HonWashingMachineMode(hass, coordinator, entry, appliance),
                HonWashingMachineSpinSpeed(hass, coordinator, entry, appliance),
                HonWashingMachineTimeRemaining(hass, coordinator, entry, appliance),
                HonWashingMachineTemp(hass, coordinator, entry, appliance),
                HonWashingMachineTotalWashCycle(hass, coordinator, entry, appliance)

you must implement those changes to the py files (don't forget to backup the files)

about our problem with spin & time remaining - i dont know how to analyse that problem. I did recive data from this var one time - strange!

HonWashingMachineTimeRemaining:

image

image

HonWashingMachineSpinSpeed:

image

i didin't change anything at all. I've looked at the APP and realized that could be a special washing-program that strangely recieve the data

gvigroux commented 1 year ago

I've merged, should work now :)