nebulous / infinitude

Open control of Carrier/Bryant thermostats
MIT License
224 stars 50 forks source link

fan with gas heat & total electric #156

Closed home409ca closed 1 year ago

home409ca commented 1 year ago

Hi, Is it possible to add the following parameters to energy.json?

The others are visible and these are missing for me.

Thanks

image

nebulous commented 1 year ago

energy.json/energy.xml actually come directly from the thermostat, so while it's technically possible for Infinitude to modify them, it doesn't by rule. That said, in my case at least it looks like fan with gas heat is available as fangas

nebulous commented 1 year ago

That said, it could make sense to add another tab to the web interface to display these data, and that could easily contain the sums - though only a fraction of Infinitude users actually use the web interface - many opting instead to have their home automation system control their thermostats via Infinitude's api. Other users (@brettonw) have also discovered that the energy monitoring feature of these stats is rather inaccurate.

home409ca commented 1 year ago

In my case, fangas shows zero. image

If possible, adding this data to energy.json would be a good feature. Inaccuracy of measurement.... I know, but better inaccurate measurement than no measurement at all.

Control from the API does not work... I use HomeAssistant and there is no integration with the Carrier.

home409ca commented 1 year ago

The software version on the controller is: 131493-14.02 Do upgrade to version 131493-14.01 (latest version, however, has a lower number - strange...)?

Will doing the upgrade give me more/other data (e.g. fangas) in energy.json?

brettonw commented 1 year ago

That said, it could make sense to add another tab to the web interface to display these data, and that could easily contain the sums - though only a fraction of Infinitude users actually use the web interface - many opting instead to have their home automation system control their thermostats via Infinitude's api. Other users (@brettonw) have also discovered that the energy monitoring feature of these stats is rather inaccurate.

I think these numbers are based on nominal resource consumption values with real usage time, rather than on actual energy measurements. It's very difficult to say how accurate they are in real life, but certainly better than nothing.

nebulous commented 1 year ago

If possible, adding this data to energy.json would be a good feature.

We can potentially have a separate endpoint which returns additional data, but it's going to be a hard sell to convince me to start modifying structures which are internal to the thermostat.

it could make sense to add another tab to the web interface to display these data

I put together a quick and dirty energy tab for the web frontend. Presently it just outputs energy.json into "usage" and "cost" tables, but more can be added there as it makes sense. Should be available in the next build next time I push to github - need to clean up some virtual SAM code that I've been working on first.

Control from the API does not work... I use HomeAssistant and there is no integration with the Carrier.

I too use Home Assistant, and you're right that Carrier provides no integration, but there is a Home Assistant integration which controls Infinitude and works well in my experience. In fact that's the primary means by which I control my thermostat.

Will doing the upgrade give me more/other data (e.g. fangas) in energy.json?

I doubt upgrading will help(and could very well hurt. Carrier hasn't introduced as many enhancements as it has breaking changes in my experience). I noticed that my energy.json also returns zeros for fangas despite having data in the thermostat interface for "fan with gas heat" so I'm possibly making an incorrect assumption as to the meaning of fangas. Perhaps it's a derived value.

nebulous commented 1 year ago

Looks like fan with gas heat can be derived by subtracting cooling and continuous fan from total electric. Also, I'll trade utility bills with you, @home409ca!

image

home409ca commented 1 year ago

I know how to perform a mathematical action, however, in energy.json I do not have "total electric" ;)

Looking forward to an update! Thanks

nebulous commented 1 year ago

🤦 yeah - that's what I get for splitting my attention between a zoom call and github. I don't have total electric in my state either. The only data Infinitude has access to is what the thermostat posts to Carrier (and what's available via RS485 if the table/register/field has been identified) and as you correctly point out, at least in energy.xml/json - it seems to not post as much info as it displays on the thermostat interface. If you can find the needed data in your state files somewhere (see /api/state_keys for a list of everything available) then I can make an api endpoint to massage the data into a more useful result.

nebulous commented 1 year ago

950047ab73 is being built/pushed to docker hub now. Should contain the new energy tab, but said tab is merely a reflection of energy.json for the time being.

GitHubGoody commented 1 year ago

@nebulous

From the Infinitude API side, is it currently possible to pull the gas and electric energy data from Infinitude into Home Assistant?

https://github.com/MizterB/homeassistant-infinitude/issues/35

Darkknight33 commented 1 year ago

@nebulous

From the Infinitude API side, is it currently possible to pull the gas and electric energy data from Infinitude into Home Assistant?

MizterB/homeassistant-infinitude#35

Infinitude is outputting the values in JSON, so, yes, it’s possible. However, you’d have to write the python connector in home assistant to poll energy.json and format the values correctly, then add them to your configuration.yaml in HA to display them.

@nebulous the output on the energy tab, could you explain year 1 vs year 2 & month 1 vs months 2 and so on? I are the units for these values in kWh & therms, respectively?

Thank you.

GitHubGoody commented 1 year ago

I think I can help with the units, but not the variables.

Here's my 2-day data from the Carrier app: image

Here are the respective sections from the Infinitude Energy tab:

image image

For gas, it looks like Infinitude (or the integration) needs to divide by 100 to get therms.

For energy, it looks like it's already in kWh.

If we can pull the day 1 data for both, hopefully it will integrate accurately with the Energy dashboard, etc.

nebulous commented 1 year ago

However, you’d have to write the python connector in home assistant to poll energy.json and format the values correctly, then add them to your configuration.yaml in HA to display them

I don't think this is required. A rest sensor in home assistant should be able to pull in values directly from infinitude with a jinja template. For example here's a little test sensor/template combo I have in my HA instance to grab infinitude status variables:

sensor:
  - platform: rest
    resource: http://192.168.1.4:3000/api/status/1
    name: infinitude_status
    value_template: '{{ value_json.rt[0] }}'
    unit_of_measurement: "°F"
    json_attributes:
      - clsp
      - currentActivity
      - damperposition
      - enabled
      - fan
      - hold
      - htsp
      - id
      - name
      - otmr
      - rh
      - rt
      - zoneconditioning
  - platform: template
    sensors:
      cool_setpoint:
        value_template: '{{ states.sensor.infinitude_status.attributes["clsp"][0] }}'
        unit_of_measurement: "°F"
      heat_setpoint:
        value_template: '{{ states.sensor.infinitude_status.attributes["htsp"][0] }}'
        unit_of_measurement: "°F"
      rt:
        friendly_name: Indoor temperature
        value_template: '{{ states.sensor.infinitude_status.attributes["rt"][0] }}'
        unit_of_measurement: "°F"
      rh:
        friendly_name: Indoor humidity
        value_template: '{{ states.sensor.infinitude_status.attributes["rh"][0] }}'
        unit_of_measurement: "%"
      basement_humidity:
        friendly_name: Basement humidity
        value_template: '{{ states.sensor.basement_rf_sensor.attributes["humidity"] }}'
        unit_of_measurement: "%"
      hvac_fan:
        friendly_name: HVAC Fan speed
        value_template: '{{ states.sensor.infinitude_status.attributes["fan"][0] }}'

I think the same pattern can be followed for energy.json including any unit conversions.

GitHubGoody commented 1 year ago

@nebulous Very cool! Rest sensors are new for me. Using your configuration as a template, here's the direction I'm heading, but I still need the proper name for each of the day1 energy keys. I think if I knew how to get to energy.json, they'd be in there. But, I don't see that in my infinitude/custom_components or share/infinitude_300X/state directories. I appreciate any help.

- platform: rest
  resource: http://192.168.0.100:3002/api/status/1
  name: infinitude_energy_sunroom
  value_template: '{{ value_json.rt[0] }}'
  # unit_of_measurement: "°F" # Commented out since units vary and are set in the templates individually
  json_attributes:
    - day1_cooling    # Upstairs, Downstairs, Sunroom
    - day1_eheat      # Upstairs, Downstairs, Sunroom
    - day1_fan        #                       Sunroom
    - day1_fangas     #                       Sunroom
    - day1_gas        # Upstairs, Downstairs, Sunroom
    - day1_hpheat     #           Downstairs, Sunroom
    - day1_reheat     #                       Sunroom
- platform: template
  sensors:
    sunroom_cooling_energy:
      name: 'Sunroom Cooling Energy'
      value_template: '{{ states.sensor.infinitude_energy_sunroom.attributes["day1_cooling"][0] }}'
      unit_of_measurement: "kWh"
    sunroom_gas:
      name: 'Sunroom Gas'
      value_template: '{{ states.sensor.infinitude_energy_sunroom.attributes["day1_gas"][0]/100 }}' # Corrects raw value to therms
      unit_of_measurement: "therms"

image

nebulous commented 1 year ago

example:


  - platform: rest
    resource: http://192.168.1.4:3000/energy.json
    name: "Heating cost"
    value_template: '{{ (value_json.energy[0].cost[0].period[0].gas[0]|float + value_json.energy[0].cost[0].period[0].cooling[0]|float + value_json.energy[0].cost[0].period[0].fan[0]|float) | round(2) }}'
    unit_of_measurement: "$"

You'll want to set the resource to the url for energy.json rather than /api/status

view your energy.json(presumably located at http://192.168.0.100:3002/energy.json) in a json viewer to more easily see where day1/2 month1/2 etc values are located. They're all identified with an id property, but are arranged in lists [day1, day2, month1, month2, year1, year2] where each of those values represents a structure containing each subkey.

image