Explanation of climate history chart?

I see; so current_operation refers to the operating mode, not the operating state. In that case, like you said, my suggestion could produce an undesirable result. I certainly wouldn’t want to see idle reported as an operating mode!


EDIT

FWIW, the Proliphix platform returns STATE_IDLE in self.current_configuration. I wonder how this is rendered by Lovelace’s thermostat card (which handles auto, heat, cool, and off)?

    def current_operation(self):
        """Return the current state of the thermostat."""
        state = self._pdp.hvac_state
        if state in (1, 2):
            return STATE_IDLE
        if state == 3:
            return STATE_HEAT
        if state == 6:
            return STATE_COOL

Just tried, mode isn’t chosen:Screenshot_20190208_184421

Just out of curiosity, how does Simple Thermostat render your new MQTT HVAC platform?

I tried the 0.86.4 version of MQTT HVAC and, as expected, the operating state is equal to the operating mode. In this screenshot, State and Mode indicate Heat but, in reality, the furnace is not running (it’s idle).

Simple%20Thermostat

Naturally, this completely screws up a History Statistics Sensor I have that reports total daily heating hours. Given that state=mode, it reports the furnace is heating all day long. Just one of a few reasons I haven’t upgraded from 0.80 yet!

You can use my old component or new until new PR is merged. Both works with 0.87.
This is Lovelace’s thermostat card with new PR:Screenshot_20190208_192733
Simple Thermostat should work same, i.e show ‘off’ or current operation mode.

Thank you. However, my custom MQTT HVAC continues to work well for 0.80. It incorporates some of your code in the PR that was cancelled (to manage operating state) plus three additional COMMAND templates:

  • CONF_MODE_COMMAND_TEMPLATE
    
  • CONF_FAN_MODE_COMMAND_TEMPLATE
    
  • CONF_HOLD_COMMAND_TEMPLATE
    

It produces this with Simple Thermostat (idle state):
Simple%20Thermostat%20-%20custom%20MQTT%20HVAC

I’ve revised my custom version of MQTT HVAC (for 0.86.4) and now have it reporting operating state independently of operating mode. The following image shows three versions of Lovelace thermostat card all showing the correct operating state (Idle, furnace is enabled but not actively heating).

This image is all three thermostat cards correctly reporting Heat (furnace is actively heating).

As a result, the temperature history chart, and my history statistics sensor, now correctly report active heating hours.

To achieve this, I had to directly act on self._state and use the state() method. In other words, I did what Paulus advised against … so my modification would never survive a PR review.

So is this heating chart already fixed? I am asking because I see few incosistencies and am not sure is it in system not ready or there is something wrong with my settings.

I have Netatmo valves. and beside more problems with duplicated valves I found that:

  1. heating period in HA do not match precissely with that in Netatmo app/webpage
  2. in HA heating chart is always filled up to environment temperature while Netatmo gives state of percentage valve opennings.

The support for Netatmo valves needs to be improved. We are aware of this and it is scheduled.

1 Like

Can you share the code behind; ‘heating hours today’ ? Would be very appreciated!!!

I have a Template Sensor that displays the thermostat’s hvac_action attribute. Then there are two History Stats sensors, one for heating and the other for cooling, that report how long hvac_action was heating, or cooling.

- platform: template
  sensors:
    hvac_activity:
      value_template: "{{ state_attr('climate.thermostat', 'hvac_action') }}"


- platform: history_stats
  name: Heating Today
  entity_id: sensor.hvac_activity
  state: 'heating'
  type: time
  start: '{{ now().replace(hour=0).replace(minute=0).replace(second=0) }}'
  end: '{{ now() }}'


- platform: history_stats
  name: Cooling Today
  entity_id: sensor.hvac_activity
  state: 'cooling'
  type: time
  start: '{{ now().replace(hour=0).replace(minute=0).replace(second=0) }}'
  end: '{{ now() }}'
3 Likes

Thanks for this! I just added this this evening and it works great!