Skip to content

Commit

Permalink
Merge pull request #6 from Pouzor/handle_multiple_commande_code
Browse files Browse the repository at this point in the history
Handle multiple code
  • Loading branch information
Pouzor authored Mar 2, 2020
2 parents 24657de + 6ca6592 commit a455b4f
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 7 deletions.
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,15 @@ To send remote code to the player, just call the service `freebox_player.remote`
code: "power"
```

/!\ For multi number channel, like `23`, you need to call the service twice, one for each number (`2` && `3`)
### Mutiple code

If you want to send multiple code like `123` for example, you need to split each code with a comma :
```yaml
code: "1,2,3"
```

Or you call multiple times the service for each number (`1` && `2` && `3`)


## Button List

Expand Down
8 changes: 6 additions & 2 deletions custom_components/freebox_player/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,12 @@ async def async_setup_freebox_player(hass, config, host, port):
async def async_freebox_player_remote(call):
"""Handle old player control (remote emulation)"""

code = call.data.get('code')
code_list = call.data.get('code')

requests.get(player_path+code, verify=False)
code_array = code.split(',')

"""Handle multiple codes, separated by comma"""
for code in code_array:
requests.get(player_path+code, verify=False)

hass.services.async_register(DOMAIN, "remote", async_freebox_player_remote)
16 changes: 12 additions & 4 deletions info.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ This component is tested on Freebox Delta, but should work too on FreeBox Revolu
* Even more incoming

## Still under developpment
This conponent use the old remote API, but since short time, Free is developping new API unrelated to remote (control player to open URL ect...)
This conponent use the old remote API, but since short time, Free is developping new API unrelated to remote (control player to open URL ect)

## Configuration
Once installed, the Freebox Player component needs to be configured in order to work.
Expand All @@ -36,12 +36,20 @@ Go to

## How to use the remote

To send remote code to the player, just call the service `freebox_player.remote` with teh code in parameter :
To send remote code to the player, just call the service `freebox_player.remote` with the code in parameter:
```yaml
code: "power"
```

/!\ For multi number channel, like `23`, you need to call the service twice, one for each number (`2` && `3`)
### Mutiple code

If you want to send multiple code like `123` for example, you need to split each code with a comma :
```yaml
code: "1,2,3"
```

Or you call multiple times the service for each number (`1` && `2` && `3`)


## Button List

Expand Down Expand Up @@ -96,4 +104,4 @@ code: "power"
* "prev" // Bouton |<< précédent
* "play" // Bouton Lecture / Pause
* "fwd" // Bouton >> avance rapide
* "next" // Bouton >>| suivant
* "next" // Bouton >>| suivant

0 comments on commit a455b4f

Please sign in to comment.