Dual Thermostat Card

After thinking about it is not so simple and it is beyond the scope of this card. The card was developed to work from a single thermostat that creates 2 entities, the temperature change command is triggered on the entity which mode is active but the mode changes are only triggered on the first entity, that works fine for dual thermostats as both entities are the same thermostat but that wouldn’t work with 2 separate thermostat, same thing applies to the status, it is only read from a single entity and not individual entities. The card was never designed to work with 2 separate entities, major changes would be required for that to work.

Understood. That is definitely a bit more work. I’d be happy to help but I’m not super comfortable with javascript unfortunately.

Maybe if I get motivated I’ll give it a shot at some point and use your work as the baseline.
If you could point out the sections within your code I might need to look at, that would be appreciated!
I also understand if you’re not interested.

Thanks anyway!

Yes, a fork of the card would be the best approach. Everything happens on the src/app.js file, then it is bundled with webpack to the dual-thermostat.js file.

Things to consider for the desired card are sending an off command to the active thermostat when switching modes to avoid having both units running at the same time, reading the status of each entity separately and the tricky part would be running an auto mode that turns on and off the necessary unit depending on temperature, among others.

Admittedly, I’m not too bright, but I can’t figure out how to get this going. I’ve downloaded the zip and unzipped the dual-thermostat directory and copied it to the www directory. I’m editing via the UI Editor (which might be the problem), and putting this in as a manual card:

- resources:
  - url: /local/dual-thermostat/dual-thermostat.js?v=1
    type: js
    
- type: custom:dual-thermostat
  name: Downstairs
  entities:
    - climate.downstairs_cool
    - climate.downstairs_heat
  fan_control: true
  min_slider: 60
  max_slider: 80

I’m getting an error that says ‘No card type found’

I must be doing this all wrong. Can someone give me a hint as to what that might be? Thanks.

If you click on to github you can see that there is a breaking change in a release after the OP was updated. Here is my working config as well if you just want to copy what I have:

1 Like

Thank you for the information. I’m still trying to figure out where:

- resources:
  - url: /local/dual-thermostat/dual-thermostat.js?v=1
    type: js

will go. Without this I’m getting a ‘No card type found’

If you’re using the frontend configureUI method, you will have to use RAW CONFIG EDITOR, and put the lines at the top of the editor.
image

/local is a reference to the www directory, so make sure your path is relative to that. Inside my www directory I have a directory called dual-thermostat, which for some reason has another dual-thermostat directory inside it with the js file.

1 Like

Had to figure out how to get into RAW CONFIG EDITOR and after that it was easy. Thanks for the help guys!

1 Like

This is awesome! Thanks, can’t believe it is not part of the core build…

only problem is that I cannot get it to display…

I have the following in my lovelace resouces (after cloning master into www and renaming dual-thermostat-master to dual-thermostat)

  - type: js
    url: /local/dual-thermostat/dual-thermostat/dual-thermostat.js?v=1

and this in the card

  - type: 'custom:dual-thermostat'
    name: Thermostat
    id: dtstat
    entities:
      - entity: climate.downstairs_thermostat
        type: cool
      - entity: climate.downstairs_thermostat_heat
        type: heat
    fan_control: true
    min_slider: 60
    max_slider: 80

I get no errors, but the card simply does not display… Any ideas?

Thanks again for an awesome card

Check the JavaScript console. Do you have any errors?

Yes, this one:

dual-thermostat.js?v=1:215 Uncaught (in promise) TypeError: Cannot read property 'indexOf' of undefined
    at HTMLElement.renderFanControl (dual-thermostat.js?v=1:215)
    at HTMLElement.render (dual-thermostat.js?v=1:197)
    at HTMLElement.update (dual-thermostat.js?v=1:136)
    at HTMLElement._validate (dual-thermostat.js?v=1:108)
    at HTMLElement._invalidate (dual-thermostat.js?v=1:108)

Try setting fan control to false. What version of HA are you on?

using HassOS 2.12 on intel Nuc… Home Assistant version 0.92.2… I noticed that there is a syntax error in the js file on line 14, not sure if this is related… can’t give you more info on the error unfortunately, that is just what dreamweaver told me when I opened the file in there…

Just to update, setting fan to false has solved my issues… Thanks for your help

No problem. I think your thermostat does not support fan control and it does not define the fan_list attribute so that throwing the error.

I am using 2 x generic thermostat components… one z-wave socket plugged into a fan and the other into a heater… I am using this in a greenhouse… at the moment, I am only seeing one dial (heat) anyway, will keep fiddling, but at least it is displaying now… thanks

Then that’s why it wasn’t working, this card was designed to be used on thermostats that create 2 entities, not two separate thermostats. Mode changes are only triggered on one entity so if you change from heat to cool, the cooling thermostat might be kept running or vice versa.

This doesn’t happen on thermostats that create 2 entities at it is still the same thermostat.

ah! OK thanks! That is a pity as I need to display both in the UI and was hoping your card could keep it tidy

I’m seeing a problem similar (maybe identical) to what’s been described above.

If I change the target temp on the physical thermostat, or via a script (i.e. not using the dual-thermostat card), the card doesn’t update to show the new target temp. This happens only with the second entity. So for this card:

entities:

  • entity: >-
    climate.radio_thermostat_company_of_america_ct101_thermostat_iris_cooling_1_4
    type: cool
  • entity: >-
    climate.radio_thermostat_company_of_america_ct101_thermostat_iris_heating_1_4
    type: heat
    fan_control: false
    max_slider: 95
    min_slider: 45
    name: South Upstairs
    type: ‘custom:dual-thermostat’

…if I change the cooling target temp on the physical thermostat, the new value shows up correctly on the card. But If I change the target heating temp, the card does not update the value unless I refresh the page in the browser, or navigate away from the page, and then back.

If I look at the raw entity display, the value is correct. But the card is not picking up the new value.

Am I doing something wrong?

First off, thank you so much for the contribution, amazing work!

I am having trouble implementing this to my instance of home assistant. I have extracted the zip, and copied the dual-thermostat file with the dual-thermostat.js under root/config/www. When trying to boot after adding it, I get the following error:
http://192.168.1.149:8123/local/dual-thermostat/dual-thermostat.js?v=1:221:2139 Uncaught Error: Invalid entity.

Here is my ui-lovelace.yaml file:

resources:
  - name: dual-thermostat
    type: js
    url: /local/dual-thermostat/dual-thermostat.js?v=1
title: APT201
views:
  - cards:
      - entities:
          - entity: climate.apartment_ac
            type: cool
          - entity: climate.apartment_heater
            type: heat
        max_slider: 95
        min_slider: 55
        name: Apartment
        type: "custom:dual-thermostat"
        fan_control: false
    icon: 'hass:home-assistant'
    id: home
    title: Home
    type: vertical-stack