I have configured sensor based on ‘snmp’ platform showing up-time of printer.
However the time is displayed in ‘TimeTick’ unit.
How to convert it to ‘normal’ date/time?
Configuration:
# Samsung printer/fax/scanner CLX-6210FX
- platform: snmp
name: 'On time'
host: 192.168.1.65
community: public
baseoid: .1.3.6.1.2.1.1.3.0
unit_of_measurement: 'H'
Dispaly result:
Source data:
mirekmal
(Mirek Malinowski)
October 24, 2020, 2:27pm
2
If this is the same as for HP printers (looking at actual data it looks very similar, you can try following template sensor:
- platform: template
sensors:
printer_uptime:
friendly_name: "Printer Uptime"
value_template: >-
{% set t = states('sensor.on_time') | int %}
{% set t = (t/10) | int %}
{{ '{:d}d {:02d}h {:02d}m'.format(t // 86400, (t // 3600) % 24, (t % 3600) // 60, (t % 3600) % 60) }}
I will return uptime in format of: 33d 05h 13m
mirekmal:
(t/10)
Thank you. In my case worked ‘(t/100)’.