Fixes in IR remote rules

This commit is contained in:
Martin Bauer 2019-12-22 20:39:08 +01:00
parent 08c18b3dee
commit 6474210927
3 changed files with 39 additions and 22 deletions

View File

@ -15,20 +15,20 @@ def get_config():
'group': 'group.bedroom',
'mapping': {
'key_1': '[playlist] Good Morning',
'key_2': '[playlist] Good Night Long',
'key_3': '[playlist] Good Night',
'btn_1': '[playlist] Good Morning',
'btn_2': '[playlist] Good Night Long',
'btn_3': '[playlist] Good Night',
'key_4': '[playlist] Bar Classics',
'key_5': '[playlist] Sentimental Moods',
'key_6': '[playlist] Pop',
'btn_4': '[playlist] Bar Classics',
'btn_5': '[playlist] Sentimental Moods',
'btn_6': '[playlist] Pop',
'key_7': '[radio] B 5 aktuell',
'key_8': '[radio] BR-Klassik',
'key_9': '[playlist] http://opml.radiotime.com/Tune.ashx?id=s25028', # Klassik Radio
'btn_7': '[radio] B 5 aktuell',
'btn_8': '[radio] BR-Klassik',
'btn_9': '[playlist] http://opml.radiotime.com/Tune.ashx?id=s25028', # Klassik Radio
'key_numeric_star': '[radio] Antenne Bayern',
'key_0': '[radio] Bayern 3',
'btn_0': '[radio] Bayern 3',
'key_numeric_pound': '[radio] Bayern 2',
'key_red': '[scene] schlafzimmer_orange',
@ -59,16 +59,16 @@ def get_config():
'group': 'group.living_area',
'mapping': {
'key_4': '[playlist] Bar Classics',
'key_5': '[playlist] Sentimental Moods',
'key_6': '[playlist] Pop',
'btn_4': '[playlist] Bar Classics',
'btn_5': '[playlist] Sentimental Moods',
'btn_6': '[playlist] Pop',
'key_7': '[radio] B 5 aktuell',
'key_8': '[radio] BR-Klassik',
'key_9': '[playlist] http://opml.radiotime.com/Tune.ashx?id=s25028', # Klassik Radio
'btn_7': '[radio] B 5 aktuell',
'btn_8': '[radio] BR-Klassik',
'btn_9': '[playlist] http://opml.radiotime.com/Tune.ashx?id=s25028', # Klassik Radio
'key_numeric_star': '[radio] Antenne Bayern',
'key_0': '[radio] Bayern 3',
'btn_0': '[radio] Bayern 3',
'key_numeric_pound': '[radio] Bayern 2',
'key_red': '[scene] wohnbereich_orange',
@ -105,7 +105,8 @@ def automation_from_config(ir_description):
elif isinstance(description, str):
function, value = split_description(description)
if function == 'playlist':
action = service('media_player.play_media', media_player, media_content_id=value)
action = service('media_player.play_media', media_player,
media_content_id=value, media_content_type='music')
elif function == 'radio':
action = service('media_player.play_media', media_player,
media_content_id=value, media_content_type='channel')
@ -127,9 +128,11 @@ def ir_trigger(ir_host, button_name):
return {
'platform': 'event',
'event_type': 'ir_command_received',
'button_name': button_name,
'repeat_counter': 0,
'host': ir_host,
'event_data': {
'button_name': button_name,
'repeat_counter': 0,
'host': ir_host,
}
}
@ -211,6 +214,16 @@ def default_music_controls(device_group, ir_host):
'trigger': [ir_trigger(ir_host, 'key_previous'), ir_trigger(ir_host, 'key_rewind')],
'action': service('media_player.media_next_track', device_group),
},
{
'alias': f'IR {ir_host} Vol Up',
'trigger': ir_trigger(ir_host, 'key_volumeup'),
'action': service('media_player.volume_up', device_group),
},
{
'alias': f'IR {ir_host} Vol Down',
'trigger': ir_trigger(ir_host, 'key_volumedown'),
'action': service('media_player.volume_down', device_group),
},
]

View File

@ -48,7 +48,6 @@ def get_local_radio_stations():
# goto ompl.radiotime with parameter ?c=local and look for your city there then paste id here
query_url = ompl_radio_browse_url + '?id=r100765'
result = get_sender_information(query_url)
print(result)
return result

5
start_dev.sh Executable file
View File

@ -0,0 +1,5 @@
#!/bin/bash
./make_config_dev.sh
hass --config ~/code/homeassistant/config/