Skip to content
This repository has been archived by the owner on Oct 4, 2021. It is now read-only.

Difficulty changing thermostat mode in home assistant #208

Closed
mrfixit1 opened this issue Oct 11, 2019 · 25 comments
Closed

Difficulty changing thermostat mode in home assistant #208

mrfixit1 opened this issue Oct 11, 2019 · 25 comments
Labels
question Further information is requested

Comments

@mrfixit1
Copy link

I'm finding it difficult to switch thermostat modes in HA with my RC20.

For example, switching from Auto to Off changes the set temperature as expected, but:

  • the HA UI shows 7 Auto;
  • the HA log says: ERROR (MainThread) [homeassistant.components.mqtt.climate] Invalid modes mode: low
  • the ems-esp says:
    Thermostat stats:
    Thermostat: RC20/Moduline 300 (ProductID:77 Version:03.03)
    Thermostat time is 10:18:30 11/10/2019
    Heating Circuit 1
    Current room temperature: 18.2 C
    Setpoint room temperature: 7.0 C
    Mode is set to low

I'm using the current climate.yaml with the modes "auto", "heat" and "off".

Any ideas?

@mrfixit1 mrfixit1 added the question Further information is requested label Oct 11, 2019
@proddy
Copy link
Collaborator

proddy commented Oct 11, 2019

yes, I see the issue. I'll fix it.

@proddy
Copy link
Collaborator

proddy commented Oct 12, 2019

fixed in 1.9.2b6 if you would be so kind to verify

@mrfixit1
Copy link
Author

Fix verified OK: switching thermostat modes now works well, the mode name and symbols under the thermostat dial in the UI are correct and the dial colour changes between green for auto and orange for heat (i.e. manual). The lights on my RC20 change immediately, although the web UI on my Android phone needs a few seconds to catch up - I guess this is inherent. Thanks for the speedy updates.

I needed to apply the following minor tweaks to get everything working:

  1. npm install instead of npm ci to install the gulp module, as the latter gave an error;
  2. as mentioned in Dual AP and wifi client mode #187, to resolve compile errors I added lib_ignore = Time to platformio.ini;
  3. climate_thermostat instead of climate.thermostat_hc1 in ui-lovelace.yaml, as the latter gave a 'not recognised' error.

proddy added a commit that referenced this issue Oct 13, 2019
@proddy
Copy link
Collaborator

proddy commented Oct 13, 2019

thanks @mrfixit1 for pointing this out. I fixed #1 with checking in the package-lock file. Also #3 was a typo. Still confused with #2 and trying to reproduce.

@proddy
Copy link
Collaborator

proddy commented Oct 13, 2019

can't reproduce #2. Tried with a fresh install (on Ubuntu then)

git clone --branch=dev https://github.com/proddy/EMS-ESP.git
cd EMS-ESP/tools/webfilesbuilder/
npm ci
cd ../..
pio run

works all the time. Try removing your whole .pio folder.

@mrfixit1
Copy link
Author

mrfixit1 commented Oct 13, 2019

Re. 1, npm ci now works for me as well, thanks for the fix.

Re. 2, after deleting the .pio folder, leaving out lib_ignore = Time now gives a series of compile errors starting with src\TimeLib.h:20:16: error: redeclaration of 'timeNotSet'. The corresponding error message in TimeLib.h is:
enum timeStatus_t::timeNotSet = 0
redeclaration of 'timeNotSet'

I've also some more collateral damage: the history graph from sensor.current_room_temperature has disappeared and the Last shower duration shows as Unknown.

@proddy proddy reopened this Oct 13, 2019
@proddy
Copy link
Collaborator

proddy commented Oct 13, 2019

I forgot about those sensors. Didn't think anyone used them anymore since there is HA climate component. I'll update the sensors.yaml file.

proddy added a commit that referenced this issue Oct 13, 2019
@mrfixit1
Copy link
Author

The temperature history graph is back, thanks for the fix.

@proddy
Copy link
Collaborator

proddy commented Oct 14, 2019

can we close this issue?

@mrfixit1
Copy link
Author

Do you have any suggestions where to look to get the shower timer working again?

@proddy
Copy link
Collaborator

proddy commented Oct 14, 2019

lol. I thought I was the only one using the shower timer! Ironically this was why I started the project in the first time, to stop my daughter from taking really long showers!

Anyway I committed some changes today to the HA configuration (sensors and automation) and it should work again. Let me know if it doesn't.

@mrfixit1
Copy link
Author

The shower timer is useful for my environmental awareness too ;-).

I updated the ems-esp code to v1.9.2b9 and copied the new changes to the automations and sensors yamls, but the shower duration and last shower at times still aren't showing.

Any further tips are welcome.

@proddy
Copy link
Collaborator

proddy commented Oct 15, 2019

Oops. Saw I forgot to update the sensors.yaml file. I think this bit

- platform: mqtt
  state_topic: 'home/ems-esp/showertime'
  name: 'Last shower duration'
  force_update: true

should have this line added:

 value_template: '{{ value_json.duration }}'

I don't have access to HA to check but try that and stimulate using something like MQTT Explorer and publish:

topic: home/ems-esp/shower_data
payload: {"timer":"1","alert":"0","duration":"4 minutes 32 seconds"}

then go to HA and check

  • no errors in the logs
  • check sensors (from development tools link)

@mrfixit1
Copy link
Author

I've added the extra line but HA is still not showing any data, both from a real event (i.e. running the shower) and test events from both MQTT Explorer and the HA UI's Developer Tools - MQTT - Publish a packet. There are no errors in the HA log.

@proddy
Copy link
Collaborator

proddy commented Oct 15, 2019

ok - will double check the config tonight.

@proddy
Copy link
Collaborator

proddy commented Oct 15, 2019

in sensors.yaml

- platform: mqtt
  name: 'Last shower duration'
  state_topic: "home/ems-esp/shower_data"
  value_template: "{{ value_json.duration }}"
  force_update: true

@mrfixit1
Copy link
Author

It's fixed, thanks. Verified OK by both running the shower for >2 mins and publishing test mqtt packages.

@majdzik84
Copy link

majdzik84 commented Oct 16, 2019

Fix verified OK: switching thermostat modes now works well, the mode name and symbols under the thermostat dial in the UI are correct and the dial colour changes between green for auto and orange for heat (i.e. manual). The lights on my RC20 change immediately, although the web UI on my Android phone needs a few seconds to catch up - I guess this is inherent. Thanks for the speedy updates.

@proddy is there a chance that RC35 will also work correctly on the thermostat in ha? for me the automatic mode is always selected (green circle) even if it is heat and it should be orange.
The buttons work correctly (switch states) but do not show the current one - they are always gray
If the RC20 succeeded, it can also be RC35?

EMS-ESP version 1.9.2b9

image

@proddy
Copy link
Collaborator

proddy commented Oct 16, 2019

I don't have an RC35 so its hard to test. It seems like the incoming MQTT are not mapped correctly. Check the climate.yaml and also experiment with sending test MQTT messages to find what the correct values should be. See the Wiki here for the correct format to use. For example from HA (MQTT Explorer) send:

topic: home/ems-esp/thermostat_data
payload: {"hc1":{"seltemp":15,"currtemp":20.6,"mode":"auto"}}

and see what happens. The mode should match the climate.yaml and valid settings are “auto”, “off”, “cool”, “heat”, “dry”, “fan_only” as specified in https://www.home-assistant.io/integrations/climate.mqtt.

For example using "off" should make it go nice and orange.

if there is a change needed in the code, let me know.

@proddy proddy reopened this Oct 16, 2019
@majdzik84
Copy link

I think the climate.yaml is correct.
I noticed that when switching to heat (day) or off (night) mode, HA returns an error in logs

Invalid modes mode: day
12:57 components/mqtt/climate.py (ERROR)
Invalid modes mode: night
12:57 components/mqtt/climate.py (ERROR) - message first occured at 12:56 and shows up 2 times

  - platform: mqtt
    name: Thermostat
    modes:
      - "auto"
      - "heat"
      - "off"

    mode_state_topic: "home/ems-esp/thermostat_data"
    current_temperature_topic: "home/ems-esp/thermostat_data"
    temperature_state_topic: "home/ems-esp/thermostat_data"

    temperature_command_topic: "home/ems-esp/thermostat_cmd_temp2"
    mode_command_topic: "home/ems-esp/thermostat_cmd_mode2"

    mode_state_template: "{{ value_json.hc2.mode }}"
    current_temperature_template: "{{ value_json.hc2.currtemp }}"
    temperature_state_template: "{{ value_json.hc2.seltemp }}"

    temp_step: 0.5

@proddy
Copy link
Collaborator

proddy commented Oct 16, 2019

Then the code logic is incorrect. For the RC35 it works like:

mode 0 low -> send off
mode 1 manual -> send heat
mode 2 auto -> send auto
mode 3 night -> send night
mode 4 day -> send day

I guess it should be just auto, heat and off. What should happen with day and night ?

@majdzik84
Copy link

majdzik84 commented Oct 16, 2019

heat is day temp and off is night temp - they switch mode but there is no visualization of this on the thermostat

@majdzik84
Copy link

in HA thermostat i have only auto, heat and off

@proddy
Copy link
Collaborator

proddy commented Oct 16, 2019

ok, mapped day->heat and night->off

@majdzik84
Copy link

super - thermostat now works correctly. Thanx
image

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants