Okay I have this working using the -rest_command- function of Home
Assistant actions, but I must note that it's kind of a shame that
there's a 'native Home Assistant LMS integration'
(https://www.home-assistant.io/integrations/squeezebox) that has a
-squeezebox.call_method- but it can't meaninfully target the correct
player! It uses Home Assistant's entity.id instead of LMS's player ID's
and it isn't doing a good job of translating between the two or
explaining in the stack trace how it intends to do that.

My first attempt at a blueprint was this:

Code:
--------------------
    alias: Squeezebox ScreenSaver
  description: >-
  Vacuum Fluorescent Displays naturally degrade over time! To prevent the
  Squeezebox 1/2 & Boom from having their displays damaged this script will set
  their powerOff display (by default the clock) brightness to 0 when no one is
  in the room with the unit AND the unit is not playing audio or idling (If the
  unit is playing audio the screen will be on regardless). When presence is
  detected, the player's PowerOff State will switch it's brightness to 6
  (Automatic)
  trigger:
  - type: motion
  platform: device
  device_id: 441923B232F232
  entity_id: binary_sensor.ezm_home_security_motion_detection_location_provided
  domain: binary_sensor
  condition: []
  action:
  - service: squeezebox.call_method
  data:
  command: playerpref
  parameters: powerOffBrightness 6
  target:
  entity_id: media_player.squeezebox_boom
  mode: single
  
--------------------


When run it does not produce the intended result at all and I only get
this unhelpful line in the LMS logs:

Code:
--------------------
    [22-04-06 11:23:27.8243] Slim::Web::JSONRPC::requestMethod (455) Request 
failed with error: Bad params!
--------------------


So for anyone trying to achieve a similar goal, the only way I've
figured out how to do this is to add two -rest_requests- to Home
Assistant's -configuration.yaml-

Code:
--------------------
    # Logitech Squeezbox hardcoded automations via REST JSON-RPC API
  rest_command:
  boom_idle:
  url: "http://192.168.2.127:9000/jsonrpc.js";
  payload: '{"id": 0,"params": 
["00:04:20:1f:40:88",["playerpref","powerOffBrightness",0]],"method": 
"slim.request"}'
  method: post
  boom_active:
  url: "http://192.168.2.127:9000/jsonrpc.js";
  payload: '{"id": 0,"params": 
["00:04:20:1f:40:88",["playerpref","powerOffBrightness",6]],"method": 
"slim.request"}'
  method: post
--------------------


This will allow you to call those rest_commands as home assistant
services!

37647


+-------------------------------------------------------------------+
|Filename: Screen Shot 2022-04-06 at 12.12.38 PM.png                |
|Download: http://forums.slimdevices.com/attachment.php?attachmentid=37647|
+-------------------------------------------------------------------+

------------------------------------------------------------------------
kezz's Profile: http://forums.slimdevices.com/member.php?userid=65905
View this thread: http://forums.slimdevices.com/showthread.php?t=116223

_______________________________________________
Squeezecenter mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/squeezecenter

Reply via email to