Magic Mirror Control From HA

Been thinking more about this. Think I need to lean some python and write my own plugin
we dont where to start tho

i did get this this working today

import json
import urllib.request
module_data = urllib.request.urlopen('http://IPADDRESS:8080/remote?action=MODULE_DATA')
modules = json.loads(module_data.read())
print(modules)
for module in modules["moduleData"]:
        print(module["name"] )
        print(module["hidden"])

which list the module i have loaded


happy with
was thinking put that into a input select and getting HA to turn hide them

can some point me down the right manual to read

added ====== 27/06/18
found this post

group_entities = hass.states.get('group.all_lights').attributes['entity_id']
all_lights = []
for e in group_entities:
    all_lights.append(e)
service_data = {'entity_id': 'input_select.timer_generico7',
                'options': all_lights}
hass.services.call('input_select', 'set_options', service_data)

run it and it worked
so …
got me thinking

import json
import urllib.request
module_data = urllib.request.urlopen('http://blabla:8080/remote?action=MODULE_DATA')
modules = json.loads(module_data.read())
my_modules = []
for module in modules["moduleData"]:
        my_modules.append(module["name"])
service_data = {'entity_id': 'input_select.mm_modules',
                'options': my_modules}
hass.services.call('input_select', 'set_options', service_data)

all I got was

:frowning:

where the manual when you need it
look like you can’t import modules

so delete the import still not working

one good thing less error lines LOL

after more read found out you can’t import :frowning:

2 Likes