Dual Thermostat Card

I am in YAML mode. I have a number of tabs (views) - this one is in a view named “Climate”.

I actually added a second thermostat (Honeywell) as well as a temp reading from the sensor on the Z-Wave thermometer. Both cards and the temperature display just fine. Here’s the complete code for the view:

- name: Climate
    title: Climate
    icon: mdi:thermometer
    cards:
    - type: vertical-stack
      cards:
      - type: thermostat
        entity: climate.main_floor
      - type: custom:dual-thermostat
        name: Upstairs
        entities:
          cool: climate.2gig_technologies_ct100_thermostat_usa_cooling_1
          heat: climate.2gig_technologies_ct100_thermostat_usa_heating_1
        fan_control: true
      - type: entities
        entities:
          - sensor.2gig_technologies_ct100_thermostat_usa_temperature

OK, when running the web app, I pulled up the “Show Page Source” (I’m on Safari on a Mac), and there was one error on the page when I went to the “Unused Entities”:

Unhandled Promise Rejection: TypeError: obj.entities.forEach is not a function. (In 'obj.entities.forEach(entity=>addEntityId(entity))', 'obj.entities.forEach' is undefined)

When I comment out the card and refresh, and revisit the page, the error goes away.

Also tried in Chrome on the Mac; same results. Here’s the error console output:

Uncaught (in promise) TypeError: obj.entities.forEach is not a function
    at addEntities (f98c2ed66c0dc1462a8d.chunk.js:1)
    at obj.cards.forEach.card (f98c2ed66c0dc1462a8d.chunk.js:1)
    at Array.forEach (<anonymous>)
    at addEntities (f98c2ed66c0dc1462a8d.chunk.js:1)
    at obj.cards.forEach.card (f98c2ed66c0dc1462a8d.chunk.js:1)
    at Array.forEach (<anonymous>)
    at addEntities (f98c2ed66c0dc1462a8d.chunk.js:1)
    at config.views.forEach.view (f98c2ed66c0dc1462a8d.chunk.js:1)
    at Array.forEach (<anonymous>)
    at computeUsedEntities (f98c2ed66c0dc1462a8d.chunk.js:1)

Thanks so much for this! I was looking into custom components to control my CT101 thermostats without 2 entities, but this is all I needed.

A neat addition would be the battery level of the thermostat in small text somewhere.

There seems to be a strange glitch that I can’t pin down to either the physical t-stat, standard card in lovelace, or the custom dual one. If I change the temp on the physical t-stat, it doesn’t change on either card. If I change it on one of the cards it will update the t-stat but not the other card.

These are all the same thermostat, but with different set points.

I see this too - it is like the cards aren’t getting the feedback from the entity about target temperature changes.

Yes, and I tried to force a refresh of the thermostat entity in the z wave control panel, no change. I’m going to play with some of the settings and see if it affects more then just the setpoints. Normally this wouldn’t bother me too much but its annoying because if i set it at the actual thermostat it some times reverts back to what the last setting was on the card.

I just did some more testing:

Changing on dual card updates: dual card, standard card, physical thermostat
Changing on standard card updates: standard card, physical thermostat
Changing on physical thermostat updates: physical thermostat

I made a sensor like this:

sensor:
  - platform: template
    sensors:
      guest_room_thermostat_heat_set:
        friendly_name: "Guest Room Target Heat"
        value_template: "{{ state_attr('climate.2gig_technologies_ct101_thermostat_iris_heating_1', 'temperature') }}"

It mirrors the behavior of the standard card, not updating when the temp is adjusted at the thermostat.

So it seems like there are 2 problems:

  1. the thermostat doesn’t broadcast changes made using its physical buttons
  2. this dual card doesn’t update the target temperature when it is changed elsewhere

This is likely to be to be caused by the thermostat not reporting back to HA check your logs to make sure HA is detecting the manual temperature change. Home Assistant will pass a hass property to the card when the state of Home Assistant changes, the card is built with polymer which reacts to the changes and updates the markup whenever the state changes.

@edwardreed81

Cannot reproduce, can you share your YAML.

I was able to reproduce let me dig thru this to see what I find.

Turned out my one thermostat is missing the fan_list.

I have the same thermostat and have seen the same problems with them since I put them in. They’ve never updated their state to HA. It’s not the fault of the card it’s the thermostat

I fought with this before by creating an automation that refreshes the entity every 30 seconds. It works great for catching the state changes for t-stat status(idle/heating/ect) I would have thought it would have taken care of this too.

Something else screwy is going on. When I change it at the t-stat sometimes it will refresh the value and then reverts back after a few seconds. :S

Believe it or not this is the same page at the same time but in different tabs. One updated, and then when I opened a new tab it was reverted back to the previous setting.

Here are the various config filesconfiguration.yaml (6.6 KB)
sensors.yaml (4.9 KB)
switchs.yaml (3.9 KB)
automations.yaml (5.5 KB)

I’ve tried this and could never get it to work and update the actual state.

I get the same thing, because the code expects obj.entities to be an array rather than object

Line 22 in https://github.com/home-assistant/home-assistant-polymer/blob/dev/src/panels/lovelace/common/compute-unused-entities.ts

So whats the fix, if there is one?

Fix would have to be a breaking change, HA is expecting the entity array to be either a string or entity object.

Line 10:

  const addEntityId = (entity) => {
    if (typeof entity === "string") {
      entities.add(entity);
    } else if (entity.entity) {
      entities.add(entity.entity);
    }
  };

The card needs a cool and heat keys on the array that are not recognized by HA.

entities:
  cool: climate.downstairs_cool
  heat: climate.downstairs_heat

I am trying to track down an issue where my fan mode changes. This only happens when I restart HA and load the page containing the Dual Thermostat card. Upon accessing the page with the dual thermostat card, I see the fan service call popup in the lower left hang corner of my browser. In my case the fan state changes from “Circulate” to “On Low”. If I manually change it, it stays put on subsequent page loads. Any help would be appreciated.

This has been fixed in 0.2.0. Note this is a breaking change and you will have to update the entity definitions.