marrobHD/tv-card

WOL on Power Button

pkracht opened this issue · 11 comments

The current power on button doesn't wake up my tv, if turned completely off.

The smart things integration does send wake-on-lan magic packets to a defined mac address in the local network.

Sending 6 times FF followed by 16 times the mac address on ip/ipx.

Would be awesome and worth a pizza... 🤜🤛

Hmm I think implementing this would be out of scope. You could add a script which does that.

Just add the script at the service option:

  power:
    service: script.wol_wakeup

See application-options and the example.

Just add the script at the service option:

  power:
    service: script.wol_wakeup

See application-options and the example.

Did not work. I don't get it, how to set the trigger. In my understanding it should be easily possible to attach an eventlistener to the action "samsung_tv.turn_on" or whatever and additional send the magic packets.

Screenshot_2023-11-03-09-20-00-68_c3a231c25ed346e59462e84656a70e50.jpg

I'm only getting an error in the footer...

I've also tried to set it directly without success.

custom_keys:
  wol:
    icon: mdi:power-cycle
    service: wake_on_lan.send_magic_packet
    data:
      mac: 00:7c:2d:5c:xx:xx
power_row:
  - power
  - wol

That's the snippet inside my automation script that works flawlessly. The automation looks like this:

alias: Samsung UE65 WOL
description: Turns on TV in Living Room
trigger: []
action:
  - service: wake_on_lan.send_magic_packet
    data:
      mac: 00:7c:2d:5c:xx:xx

Please provide your full configuration of the card. I will look into it.

Please provide your full configuration of the card. I will look into it.

The current configuration of my card looks like this

type: custom:tv-card
entity: media_player.samsungtv_ue65
title: Samsung UE65
custom_keys:
  wol:
    icon: mdi:power-cycle
    service: wake_on_lan.send_magic_packet
    data:
      mac: 00:7c:2d:5c:a5:d3
power_row:
  - power
  - wol
channel_row:
  - channel_up
  - info
  - channel_down
apps_row:
  - netflix
  - null
  - youtube
volume_row: buttons
navigation_row: touchpad
source_row:
  - return
  - home
  - source
media_control_row:
  - rewind
  - play
  - pause
  - fast_forward

I did test your version like this, but only gives errors (service not found):

type: custom:tv-card
entity: media_player.samsungtv_ue65
title: Samsung UE65
custom_keys:
  power:
    icon: mdi:power-cycle
    service: automation.samsung_ue65_wol
power_row:
  - power
channel_row:
  - channel_up
  - info
  - channel_down
apps_row:
  - netflix
  - null
  - youtube
volume_row: buttons
navigation_row: touchpad
source_row:
  - return
  - home
  - source
media_control_row:
  - rewind
  - play
  - pause
  - fast_forward

The full automation script looks like this:

alias: Samsung UE65 WOL
description: Turns on TV in Living Room
trigger: []
action:
  - service: wake_on_lan.send_magic_packet
    data:
      mac: 00:7c:2d:5c:xx:xx

And can be triggered (executed) by button on automation.samsung_ue65_wol or just by the service snippet with mac data.

If I'd know which trigger is executed by pressing the "power" button on the remote, I cool hook into it and send the magic packet after/on pressing the button...

I tried almost every combination of shifting the data parameters and added optional broadcast, but it always gives me a footer notification data['mac'] is not defined...

custom_keys:
  wol:
    icon: mdi:power-cycle
    service: wake_on_lan.send_magic_packet
    data:
      broadcast_address: 172.16.47.255
      mac: 00:7c:2d:5c:a5:d3

Is the data passed to the service unmodified?

Enabling wake_on_lan: in configuration.yaml and executing this service with given parameters activates almost every TV from deep sleep.

params:
  domain: wake_on_lan
  service: send_magic_packet
  service_data:
    mac: 00:7c:2d:5c:a5:d3
    broadcast_address: 172.16.47.255
    broadcast_port: 9
  target: {}
running_script: false

The corresponding automation.wol.yaml is the following:

id: '1698866101410'
alias: Samsung UE65 WOL
description: Turns on TV in Living Room
trigger: []
action:
  - service: wake_on_lan.send_magic_packet
    data:
      mac: 00:7c:2d:5c:a5:d3
      broadcast_address: 172.16.47.255
      broadcast_port: 9

I really have no clue what you're trying to configure... There is no option such as "media_control_row". Read the README.

That's how you send a wol packet after power button press in card. Do not forget to set tv to true!

type: custom:tv-card
entity: media_player.samsungtv_ue65
title: Samsung UE65
tv: true
power:
  service: wake_on_lan.send_magic_packet
  service_data:
    mac: 00:7c:2d:5c:a5:d3
    broadcast_address: 172.16.47.255
    broadcast_port: 9

Sorry for circumstances. I messed up with the namespace. Your card is named equal as another one. Maybe you should fix this maybe.

The one you forked from: https://github.com/usernein/tv-card

type: custom:tv-card
entity: media_player.samsungtv_ue65
title: Samsung UE65
custom_keys:
  wol:
    icon: mdi:power-cycle
    service: wake_on_lan.send_magic_packet
    service_data:
      mac: 00:7c:2d:5c:a5:d3
power_row:
  - power
  - wol
channel_row:
  - channel_up
  - info
  - channel_down
apps_row:
  - netflix
  - null
  - youtube
volume_row: buttons
navigation_row: touchpad
source_row:
  - return
  - home
  - source
media_control_row:
  - rewind
  - play
  - pause
  - fast_forward

This configuration now works as expected. It's a pitty that I can't do both on the same button but it works.

Screenshot_2023-11-07-23-56-54-39_c3a231c25ed346e59462e84656a70e50.jpg

Well, you're not using my card... You're using some fork! Next time open an issue there