home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
71.11k stars 29.79k forks source link

Opentherm integration sends tons of messages when actual state isn't changing #35714

Closed iamkarlson closed 4 years ago

iamkarlson commented 4 years ago

The problem

I have an OTGW device installed next to my boiler and integrated it in Home Assistant. Most of the things works fine and there are no blockers for performing streamlined tasks like automations or so. However, if you want to check the state of the boiler for example you would notice that it's being constantly changed from ON to OFF and vice versa when boiler is heating water. It makes things complex to analyze and create unnecessary load on the recorder (influxdb in my case).

Environment

Hassio image for NUC instaled in VM:

arch | x86_64
-- | --
dev | false
docker | true
hassio | true
os_name | Linux
os_version | 4.15.0-99-generic
python_version | 3.7.7
timezone | Europe/Amsterdam
version | 0.109.6
virtualenv | false

Problem-relevant configuration.yaml

opentherm_gw:
  otgw_unit:
    device: socket://192.168.1.123:6638

Traceback/Error logs

Event 5 fired 10:16 PM:
{
    "event_type": "state_changed",
    "data": {
        "entity_id": "binary_sensor.master_ch_enabled_otgw_unit",
        "old_state": {
            "entity_id": "binary_sensor.master_ch_enabled_otgw_unit",
            "state": "off",
            "attributes": {
                "friendly_name": "Thermostat Central Heating Enabled otgw_unit"
            },
            "last_changed": "2020-05-16T20:16:35.017887+00:00",
            "last_updated": "2020-05-16T20:16:35.017887+00:00",
            "context": {
                "id": "3d46d3f3eea3460dbfa88c4a2b2d3bbb",
                "parent_id": null,
                "user_id": null
            }
        },
        "new_state": {
            "entity_id": "binary_sensor.master_ch_enabled_otgw_unit",
            "state": "on",
            "attributes": {
                "friendly_name": "Thermostat Central Heating Enabled otgw_unit"
            },
            "last_changed": "2020-05-16T20:16:35.023014+00:00",
            "last_updated": "2020-05-16T20:16:35.023014+00:00",
            "context": {
                "id": "d10e1f59d00e475b922cd91a347a15ac",
                "parent_id": null,
                "user_id": null
            }
        }
    },
    "origin": "LOCAL",
    "time_fired": "2020-05-16T20:16:35.023041+00:00",
    "context": {
        "id": "d10e1f59d00e475b922cd91a347a15ac",
        "parent_id": null,
        "user_id": null
    }
}
Event 4 fired 10:16 PM:
{
    "event_type": "state_changed",
    "data": {
        "entity_id": "binary_sensor.master_ch_enabled_otgw_unit",
        "old_state": {
            "entity_id": "binary_sensor.master_ch_enabled_otgw_unit",
            "state": "on",
            "attributes": {
                "friendly_name": "Thermostat Central Heating Enabled otgw_unit"
            },
            "last_changed": "2020-05-16T20:16:34.489149+00:00",
            "last_updated": "2020-05-16T20:16:34.489149+00:00",
            "context": {
                "id": "6e9f00ed847c43c2b452814d4a8ed8a9",
                "parent_id": null,
                "user_id": null
            }
        },
        "new_state": {
            "entity_id": "binary_sensor.master_ch_enabled_otgw_unit",
            "state": "off",
            "attributes": {
                "friendly_name": "Thermostat Central Heating Enabled otgw_unit"
            },
            "last_changed": "2020-05-16T20:16:35.017887+00:00",
            "last_updated": "2020-05-16T20:16:35.017887+00:00",
            "context": {
                "id": "3d46d3f3eea3460dbfa88c4a2b2d3bbb",
                "parent_id": null,
                "user_id": null
            }
        }
    },
    "origin": "LOCAL",
    "time_fired": "2020-05-16T20:16:35.017933+00:00",
    "context": {
        "id": "3d46d3f3eea3460dbfa88c4a2b2d3bbb",
        "parent_id": null,
        "user_id": null
    }
}
Event 3 fired 10:16 PM:
{
    "event_type": "state_changed",
    "data": {
        "entity_id": "binary_sensor.master_ch_enabled_otgw_unit",
        "old_state": {
            "entity_id": "binary_sensor.master_ch_enabled_otgw_unit",
            "state": "off",
            "attributes": {
                "friendly_name": "Thermostat Central Heating Enabled otgw_unit"
            },
            "last_changed": "2020-05-16T20:16:34.459035+00:00",
            "last_updated": "2020-05-16T20:16:34.459035+00:00",
            "context": {
                "id": "f33725c1a2eb407c8828862cbbb46cfa",
                "parent_id": null,
                "user_id": null
            }
        },
        "new_state": {
            "entity_id": "binary_sensor.master_ch_enabled_otgw_unit",
            "state": "on",
            "attributes": {
                "friendly_name": "Thermostat Central Heating Enabled otgw_unit"
            },
            "last_changed": "2020-05-16T20:16:34.489149+00:00",
            "last_updated": "2020-05-16T20:16:34.489149+00:00",
            "context": {
                "id": "6e9f00ed847c43c2b452814d4a8ed8a9",
                "parent_id": null,
                "user_id": null
            }
        }
    },
    "origin": "LOCAL",
    "time_fired": "2020-05-16T20:16:34.489173+00:00",
    "context": {
        "id": "6e9f00ed847c43c2b452814d4a8ed8a9",
        "parent_id": null,
        "user_id": null
    }
}
Event 2 fired 10:16 PM:
{
    "event_type": "state_changed",
    "data": {
        "entity_id": "binary_sensor.master_ch_enabled_otgw_unit",
        "old_state": {
            "entity_id": "binary_sensor.master_ch_enabled_otgw_unit",
            "state": "on",
            "attributes": {
                "friendly_name": "Thermostat Central Heating Enabled otgw_unit"
            },
            "last_changed": "2020-05-16T20:16:33.930225+00:00",
            "last_updated": "2020-05-16T20:16:33.930225+00:00",
            "context": {
                "id": "d7c25859e4934c82afc618b35e40a3a3",
                "parent_id": null,
                "user_id": null
            }
        },
        "new_state": {
            "entity_id": "binary_sensor.master_ch_enabled_otgw_unit",
            "state": "off",
            "attributes": {
                "friendly_name": "Thermostat Central Heating Enabled otgw_unit"
            },
            "last_changed": "2020-05-16T20:16:34.459035+00:00",
            "last_updated": "2020-05-16T20:16:34.459035+00:00",
            "context": {
                "id": "f33725c1a2eb407c8828862cbbb46cfa",
                "parent_id": null,
                "user_id": null
            }
        }
    },
    "origin": "LOCAL",
    "time_fired": "2020-05-16T20:16:34.459065+00:00",
    "context": {
        "id": "f33725c1a2eb407c8828862cbbb46cfa",
        "parent_id": null,
        "user_id": null
    }
}
Event 1 fired 10:16 PM:
{
    "event_type": "state_changed",
    "data": {
        "entity_id": "binary_sensor.master_ch_enabled_otgw_unit",
        "old_state": {
            "entity_id": "binary_sensor.master_ch_enabled_otgw_unit",
            "state": "off",
            "attributes": {
                "friendly_name": "Thermostat Central Heating Enabled otgw_unit"
            },
            "last_changed": "2020-05-16T20:16:33.905847+00:00",
            "last_updated": "2020-05-16T20:16:33.905847+00:00",
            "context": {
                "id": "ce1368b4aa854365a4827c08cc6ee4ed",
                "parent_id": null,
                "user_id": null
            }
        },
        "new_state": {
            "entity_id": "binary_sensor.master_ch_enabled_otgw_unit",
            "state": "on",
            "attributes": {
                "friendly_name": "Thermostat Central Heating Enabled otgw_unit"
            },
            "last_changed": "2020-05-16T20:16:33.930225+00:00",
            "last_updated": "2020-05-16T20:16:33.930225+00:00",
            "context": {
                "id": "d7c25859e4934c82afc618b35e40a3a3",
                "parent_id": null,
                "user_id": null
            }
        }
    },
    "origin": "LOCAL",
    "time_fired": "2020-05-16T20:16:33.930244+00:00",
    "context": {
        "id": "d7c25859e4934c82afc618b35e40a3a3",
        "parent_id": null,
        "user_id": null
    }
}
Event 0 fired 10:16 PM:
{
    "event_type": "state_changed",
    "data": {
        "entity_id": "binary_sensor.master_ch_enabled_otgw_unit",
        "old_state": {
            "entity_id": "binary_sensor.master_ch_enabled_otgw_unit",
            "state": "on",
            "attributes": {
                "friendly_name": "Thermostat Central Heating Enabled otgw_unit"
            },
            "last_changed": "2020-05-16T20:16:33.367125+00:00",
            "last_updated": "2020-05-16T20:16:33.367125+00:00",
            "context": {
                "id": "7a11ba5ebfab428d9d8549441daf0f7b",
                "parent_id": null,
                "user_id": null
            }
        },
        "new_state": {
            "entity_id": "binary_sensor.master_ch_enabled_otgw_unit",
            "state": "off",
            "attributes": {
                "friendly_name": "Thermostat Central Heating Enabled otgw_unit"
            },
            "last_changed": "2020-05-16T20:16:33.905847+00:00",
            "last_updated": "2020-05-16T20:16:33.905847+00:00",
            "context": {
                "id": "ce1368b4aa854365a4827c08cc6ee4ed",
                "parent_id": null,
                "user_id": null
            }
        }
    },
    "origin": "LOCAL",
    "time_fired": "2020-05-16T20:16:33.905876+00:00",
    "context": {
        "id": "ce1368b4aa854365a4827c08cc6ee4ed",
        "parent_id": null,
        "user_id": null
    }
}

Additional information

probot-home-assistant[bot] commented 4 years ago

Hey there @mvn23, mind taking a look at this issue as its been labeled with a integration (opentherm_gw) you are listed as a codeowner for? Thanks! (message by CodeOwnersMention)

mvn23 commented 4 years ago

Thanks for the report. Unfortunately, I am unable to reproduce the issue. Does this happen all the time or only in a certain state/under certain conditions? Are you changing the room setpoint in HA/on the thermostat or through one of the opentherm_gw service calls? If through a service call, which one? Can you add a debug log for homeassistant.components.opentherm_gw when the problem occurs?

iamkarlson commented 4 years ago

Hi @mvn23, It occurs all the time when the boiler heating water. Here's how I'm setting it to heat:

  action:
  - service: opentherm_gw.set_control_setpoint
    data_template:
      gateway_id: otgw_unit
      temperature: "{{ states('input_number.boiler_water_setpoint_input') | int }}"

Log: https://pastebin.com/19w4bKaV

mvn23 commented 4 years ago

This is not a bug in Home Assistant, but in the pyotgw library that we're using to communicate with the gateway. As soon as an override is active on the gateway, there's a discrepancy between what is received from the thermostat and what is sent to the boiler. Currently, pyotgw is picking up both values and sending out updates for each of them. I am planning to update pyotgw to better support this scenario, but there's no ETA on this yet. For now, you can exclude the misbehaving entities from logging to both the recorder and influxdb to get rid of the clutter in the databases.

iamkarlson commented 4 years ago

Thanks @mvn23 this is a really good piece of advice! Would you mind if I keep this issue open till it resolved?

stale[bot] commented 4 years ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue now has been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

iamkarlson commented 4 years ago

Not solved!