emsesp / EMS-ESP

ESP8266 firmware to read and control EMS and Heatronic compatible equipment such as boilers, thermostats, solar modules, and heat pumps
https://emsesp.github.io/docs
GNU Lesser General Public License v3.0
303 stars 97 forks source link

Difficulty changing thermostat mode in home assistant #208

Closed mrfixit1 closed 5 years ago

mrfixit1 commented 5 years ago

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:

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

Any ideas?

proddy commented 5 years ago

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

proddy commented 5 years ago

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

mrfixit1 commented 5 years ago

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 #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 commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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.

mrfixit1 commented 5 years ago

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

proddy commented 5 years ago

can we close this issue?

mrfixit1 commented 5 years ago

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

proddy commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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

mrfixit1 commented 5 years ago

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 commented 5 years ago

ok - will double check the config tonight.

proddy commented 5 years ago

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 commented 5 years ago

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

majdzik84 commented 5 years ago

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 commented 5 years ago

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.

majdzik84 commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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

majdzik84 commented 5 years ago

in HA thermostat i have only auto, heat and off

proddy commented 5 years ago

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

majdzik84 commented 5 years ago

super - thermostat now works correctly. Thanx image