Code Monkey home page Code Monkey logo

Comments (4)

LAB02-Admin avatar LAB02-Admin commented on May 23, 2024 1

Closing this for now, but feel free to reopen if it doesn't work for you!

You can follow the new system I mentioned in ticket [#41]

from hass.agent.

LAB02-Admin avatar LAB02-Admin commented on May 23, 2024

Hi @VNRARA,

Thank you for your bug report, and attaching the logs (love it when that gets done without asking).

I've been trying to reproduce your issue, as there are systems in place that should prevent this - and there are mentions in your logs that HASS.Agent did reconnect after a failure.

For starters, I had to update my staging system, so that meant it went offline for a bit. HASS.Agent fell into alternating between connecting/failed mode, as expected (please ignore the notification api state, it's not enabled on my staging setup):

image

When HA came back online, both reconnected (took a minute or so):

image

For test 2, I completely shutdown the staging HA environment. In this test, HASS.Agent demonstrated the same behavior: when I started HA after about 10 minutes, both the API and MQTT reconnected.

For test 3, I shutdown the staging HA environment, shutdown HASS.Agent, and then started HASS.Agent (so it wouldn't be able to connect initially). After 5 minutes I started HA, and this resulted in interesting behavior: after a short while MQTT connected, however the API did not:

image

So this is a bug, and I'll fix it: hassagent-47

However, regarding your issue: sensors and commands worked just fine. Even after test 3, I tested both. That would make sense, because they use MQTT - the HA API is only used for fetching entities and their state for the Quick Actions.

Could you please give me some more info, so I can more accurately try to reproduce:

  • What's the sequence that caused it (HASS.Agent is and stays active, HA goes down, HA goes back up, something like that)
  • Do you have both sensors and commands configured
  • Is everything working OK normally
  • Exactly what time did the situation start (so we can pinpoint in the logs)
  • How did you notice the sensors/commands stopped working (through the system status main screen, or missing updates, or..?)

Also, if you have the time, could you please install the latest beta (no need to uninstall anything, you can just run it):

https://github.com/LAB02-Research/HASS.Agent/releases/download/b2022.11.2/HASS.Agent.Installer.exe

This one creates seperate logs for the task-specific child applications (like 'restart hass') so you won't get the 'log file already in use' errors. You don't have to, it's not likely the beta will fix your bug.

Thank you very much for your time!

from hass.agent.

VNRARA avatar VNRARA commented on May 23, 2024

Thanks for getting back to me so quick: I was able to reproduce and screengrab and some more logs:

I reboot HA:

image

It starts loading everything back up:

image

Once started my custom sensors are not available:

image

Resolution X and Y are unknown untill I restore the sensors.

image

Resaving the sensor:

image

image

And it works again:

[2022-04-21] HASS.Agent_20220421_009.log

from hass.agent.

LAB02-Admin avatar LAB02-Admin commented on May 23, 2024

Thanks, very helpful!

The issue here is that HASS.Agent thinks as follows: the sensor's value hasn't changed, so I don't need to send it again. There is a mechanism that resends all values after a reconnection, but that doesn't always work because the timing needs to be precise.

I'm working on an alternative system, that uses the HA API to constantly check whether HASS.Agent's last known sensor value match with the value that HA has for that sensor. If they don't match, HASS.Agent will resend the value. That way, no matter what the underlying cause is, it'll always stay in sync.

Until then, you can use a PublishAllSensors command:

image

You can set it to trigger after a HA restart, using the platform start trigger in combination with a short delay:

  trigger:
    - platform: homeassistant
      event: start
  action:
    - delay:
        minutes: 2

If you use the Satellite Service, you can create the same command for that as well. So just trigger both commands from your automation.

Hopefully this'll fix it for you until I have the backup system ready (won't be until next release).

from hass.agent.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.