TypeError: Entity.set_state() takes 1 positional argument but 2 were given #2191
Labels
bug
Something isn't working
work_in_progress
Isse or PR that is evolving and shouldn't;t be aged out
What happened?
This is interesting.
The code is scheduled to run every 15 minutes. The night before last the app was started about 7:40 PM and ran fine until midnight. Then it started throwing the errors. Each 15 minutes it would attempt to run again but fail. (Failing at midnight is a coincidence and isn't part of the problem. The problem has occurred at other times.)
Sometimes the error occurs sooner after the app is started, maybe after a half-hour or so.
The problem code is: (There's some more context below in the code section)
self.high_temp_ent.set_state(fTemperature)
Changing the code to the following seems to fix the problem:
self.high_temp_ent.set_state(state = fTemperature)
As can be seen self.high_temp_ent.set_state is an AppDaemon entity.
It's odd that it works for a while. Although the log entry says that the app and thread are pinned I did not explicitly pin either of them. (It's probably the default behavior but I thought I'd mention it.)
It's not a problem for me. The fix works. The app has now been running for over 24 hours and hasn't had any problems.
I would add that I saw the deprecation notice by Frenck and I understand and support AppDaemon's position. Home Assistant wouldn't have the same value without AppDaemon. Home Assistant provides the building blocks. AppDaemon allows me to create... magic.
I have two Home Assistant instances. One is "old" running Home Assistant and AppDaemon in Python virtual environments. (I need to upgrade but dread the z-wave upgrade.) The other instance is new and uses Frenck's add-on. I can use AppDaemon in a virtual environment or I can add AppDaemon through Docker if I need to. There's no way that I'm running Home Assistant without AppDaemon.
Version
4.4.2
Installation type
Home Assistant add-on
Relevant log output
Relevant code in the app or config file that caused the issue
Anything else?
No response
The text was updated successfully, but these errors were encountered: