I have a magicmirror.
After the defunct integration, I’ve reset it to use MQTT to turn the monitor on and off.
I can’t adjust the brigthness this way, so I wanted to look into using the RESTful(ish) remote_control module for the magic mirror so I can adjust the brightness as well.
I’m not a coder, so I can’t figure out how to fix the integration (GitHub - sindrebroch/ha-magicmirror: Custom HomeAssistant-integration for MagicMirror) I can see all the ‘api’ commands looks correct, so it must be something in the python that is no longer aligned with HA…
I’ve gotten three files created.
A rest_command
A sensor
A light
The list of API commands are shown here:
https://ezeholz.com.ar/MMM-Remote-Control/#/API/get_api_brightness___setting_
In my rest_command I have three commands defined:
turn_on_monitor:
url: "http://10.11.12.7:8080/api/monitor/on?apiKey=xxx"
method: get
turn_off_monitor:
url: "http://10.11.12.7:8080/api/monitor/off?apiKey=xxx"
method: get
set_monitor_brightness:
url: "http://10.11.12.7:8080/api/brightness/{{ brightness }}?apiKey=apiKey=xxx"
method: get
Then I have a sensor to tell if the light is turned on or off:
- platform: rest
name: MagicMirror Monitor rest
resource: "http://10.11.12.7:8080/api/monitor/?apiKey=xxx"
method: GET
value_template: "{{ value_json.monitor }}"
Finally I have the light defined:
magicmirror_monitor_rest:
friendly_name: "MagicMirror Monitor rest"
turn_on:
service: rest_command.turn_on_monitor
turn_off:
service: rest_command.turn_off_monitor
value_template: "{{ is_state('sensor.magicmirror_monitor_rest', 'on') }}"
set_level:
service: rest_command.set_monitor_brightness
data_template:
brightness: "{{ (brightness / 255 * 100) | int }}"
This works for turning it on and off (reporting the state has a delay of upto 15s), but ir does not work for setting brightness.
If I use postman and send a URL like
http://10.11.12.7:8080/api/brightness/50?apiKey=xxx
It sets the brightness to 50% (I can get it reported by simply not giving the 50 as a value).
But I don’t see anything change when I try to use the light from HA?