WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am writing a simple monitoring tool for some HA and non-HA services. Since HA is a state machine I will outsource the heavy lifting to HA. My question is related to a HTTP monitor but is not specific (I want to use a concrete example to show my issue).
I was planning, based on a configuration file, to first create entities, and then periodically check the helth of the endpoints and update the state accordingly. The code is
I get two entities for each entry: the one explicitly created at startup and the one created as a side effect of setting a state:
The correct entry is the second one (with states ok or failed) and my question is: why are they duplicated?
I would appreciate any pointers, finding detailed information about entities IDs is not simple.
PS. Now that I think of it, I do not need to explicitly create the entities and just rely on setting the state (which will prevent the creation of multiple entities) - but I am curious to understand the details anyway.
Just in case some gets here like me and wonder:
It is doubling entities because you were publishing to "homeassistant/binary_sensor/http_{endpoint['name']}/config" effectively (for example) creating binary_sensor.http_bitwarden but then you were implicitly creating another entity monitoring.http_bitwarden in your @service. Beside that there is no such entity type as ”monitoring”, it is better to propagate changes of mqtt defined entities to HA by mqtt.publish() on appropriate topic, this way it's easier not to mess it up and it won't stop working when for example you would change entity name from HA frontend not remembering details of its use in code.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
I am writing a simple monitoring tool for some HA and non-HA services. Since HA is a state machine I will outsource the heavy lifting to HA. My question is related to a HTTP monitor but is not specific (I want to use a concrete example to show my issue).
I was planning, based on a configuration file, to first create entities, and then periodically check the helth of the endpoints and update the state accordingly. The code is
Using the configuration file
I get two entities for each entry: the one explicitly created at startup and the one created as a side effect of setting a state:
The correct entry is the second one (with states
okorfailed) and my question is: why are they duplicated?I would appreciate any pointers, finding detailed information about entities IDs is not simple.
PS. Now that I think of it, I do not need to explicitly create the entities and just rely on setting the state (which will prevent the creation of multiple entities) - but I am curious to understand the details anyway.
Beta Was this translation helpful? Give feedback.
All reactions