Can't seem to show when the fan is on in Apex

Hi all

I have Apex Charts set up monitoring my CPU temp and triggering a USB switch when the temp is too high. System is a fanless one but I don’t like it when it gets too hot, so just stuck a USB switch with a little USB fan.

Anyway, I’m using the transform function which worked before and according to all the posts I’ve read, should work. But it doesn’t. The entity does show off and on times but nothing is shown in the chart.

What am I doing wrong?

type: custom:mini-graph-card
name: Temperature - 24hr
icon: mdi:server
hours_to_show: 24
points_per_hour: 30
animate: true
line_width: 2
apex_config:
  yaxis:
    min: 30
    max: 80
entities:
  - entity: sensor.system_monitor_processor_temperature
    name: CPU Temperature
  - entity: switch.switch_usb_ha_cooling_fan_l2
    name: Fan
    transform: "return x === 'on' ? 80 : 0;"

That looks correct to me - try changing the 0 option to (say) 40 - if you get a lot of 40s you’ll know the test is failing.

Thanks for the reply. I tried that but nothing is showing at all. This is confusing the hell out of me

Ok, very stupid error by me. The card wasn’t an Apex card but in fact a mini-graph card. That was why nothing worked properly. Sorry for wasting your time :confused: