Skip to content

Commit

Permalink
Merge pull request #102 from mreditor97/dev
Browse files Browse the repository at this point in the history
Changed state_class to measurement for Print Time sensor
  • Loading branch information
cmroche authored Jul 3, 2023
2 parents db599c8 + 529b58a commit d06aa34
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions octoprint_homeassistant/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,7 @@ def _generate_device_registration(self):
"name": _node_name + " Print Time",
"uniq_id": _node_id + "_PRINTING_T",
"stat_t": "~" + self._generate_topic("hassTopic", "printing"),
"stat_cla": "measurement",
"val_tpl": "{{value_json.progress.printTimeFormatted}}",
"device": _config_device,
"ic": "mdi:clock-start",
Expand All @@ -364,6 +365,7 @@ def _generate_device_registration(self):
"name": _node_name + " Print Time Left",
"uniq_id": _node_id + "_PRINTING_E",
"stat_t": "~" + self._generate_topic("hassTopic", "printing"),
"stat_cla": "measurement",
"val_tpl": "{{value_json.progress.printTimeLeftFormatted}}",
"device": _config_device,
"ic": "mdi:clock-end",
Expand Down Expand Up @@ -391,6 +393,7 @@ def _generate_device_registration(self):
"name": _node_name + " Approximate Completion Time",
"uniq_id": _node_id + "_PRINTING_C",
"stat_t": "~" + self._generate_topic("hassTopic", "printing"),
"stat_cla": "measurement",
"val_tpl": "{{'None' if not value_json.progress.printTimeLeft else (now() + timedelta(seconds=value_json.progress.printTimeLeft|int(default=0))).timestamp()|timestamp_custom('%b %d, %X')}}",
"device": _config_device,
},
Expand Down

0 comments on commit d06aa34

Please sign in to comment.