It is working!
I deleted my ha db and restarted ha. Now it shows everything.
Thnx everyone for help
Just to double check because my is reporting 0hour,
was the final code
history:
sensor:
- platform: history_stats
name: PS4 today
entity_id: switch.playstation4
state: 'on'
type: time
start: '{{ now().replace(hour=0).replace(minute=0).replace(second=0) }}'
end: '{{ now() }}'
- platform: template
sensors:
ps4_today_time:
friendly_name: PS4 Time Today
value_template: "{{ state_attr('sensor.ps4_today') }}"
switch:
- platform: command_line
switches:
playstation4:
command_on: "echo on"
command_off: "echo off"
command_state: "nc -z -w 5 ps4ip 9295"
friendly_name: PlayStation
I take it back itβs seems to work now! thanks a lot