Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

item.py: allow log level to be set by eval expression #681

Merged
merged 1 commit into from
Oct 16, 2024

Conversation

onkelandy
Copy link
Member

No description provided.

onkelandy added a commit to onkelandy/smarthome that referenced this pull request Oct 11, 2024
@Morg42 Morg42 merged commit f8a5aa2 into smarthomeNG:develop Oct 16, 2024
5 checks passed
@msinn
Copy link
Member

msinn commented Oct 17, 2024

@onkelandy , @Morg42 Seitdem ich nach diesen PR gepullt habe, fliegt mir SmartHomeNG nur noch um die Ohren.

Im Log habe ich zu dieversen Items folgende Exceptions:

2024-10-18  00:28:55 ERROR    lib.item.item          <built-in function id>: Invalid log_level template 'None' - (Exception: 'NoneType' object has no attribute 'replace')
2024-10-18  00:28:55 ERROR    lib.item.item          Item wohnung.kochen.heizung.hvac: problem creating: 'NoneType' object has no attribute 'upper'
Traceback (most recent call last):
  File "/usr/local/shng_dev/lib/item/item.py", line 551, in __init__
    child = Item(smarthome, self, child_path, value)
  File "/usr/local/shng_dev/lib/item/item.py", line 635, in __init__
    update = plugin.parse_item(self)
  File "/usr/local/shng_dev/plugins/rtr2/__init__.py", line 226, in parse_item
    self._rtr[rtr_id].update_rtr_items('Init')
  File "/usr/local/shng_dev/plugins/rtr2/__init__.py", line 590, in update_rtr_items
    self._update_item(self.hvac_item, self._mode.hvac, src=ignore_function)
  File "/usr/local/shng_dev/plugins/rtr2/__init__.py", line 616, in _update_item
    item(value, self.plugin.get_shortname(), src)
  File "/usr/local/shng_dev/lib/item/item.py", line 1539, in __call__
    self.__update(value, caller, source, dest, key, index)
  File "/usr/local/shng_dev/lib/item/item.py", line 2420, in __update
    self._set_value(value, caller, source, dest, prev_change=None, last_change=None)
  File "/usr/local/shng_dev/lib/item/item.py", line 2376, in _set_value
    self._log_on_change(value, caller, source, dest)
  File "/usr/local/shng_dev/lib/item/item.py", line 2312, in _log_on_change
    level = log_level.upper()
AttributeError: 'NoneType' object has no attribute 'upper'

Ich habe die Änderung bei mir lokal erstmal wieder raus gefahren, damit mein SmartHomeNG wieder läuft.

@onkelandy
Copy link
Member Author

Oha, sorry. Da hat die Testabteilung wohl ein Szenario übersehen...
Zeile 291 müsste self._log_level_attrib = "INFO" heißen. Ich pushe gleich und freue mich über erneuten Test.

@onkelandy onkelandy deleted the log_level branch December 5, 2024 05:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants