Merge PR #459: New plugin: Yamaha network receiver

master
Jenkins nymea 2021-09-07 17:35:52 +02:00
commit b338b55cc4
9 changed files with 2293 additions and 0 deletions

17
debian/control vendored
View File

@ -1096,6 +1096,22 @@ Description: nymea.io plugin to monitor the ISS position
This package will install the nymea.io plugin for wheretheiss.at
Package: nymea-plugin-yamahaavr
Architecture: any
Depends: ${shlibs:Depends},
${misc:Depends},
nymea-plugins-translations,
python3-pip,
Description: nymea.io plugin for Yamaha receivers
The nymea daemon is a plugin based IoT (Internet of Things) server. The
server works like a translator for devices, things and services and
allows them to interact.
With the powerful rule engine you are able to connect any device available
in the system and create individual scenes and behaviors for your environment.
.
This package will install the nymea.io plugin for (non-Musiccast) Yamaha AV receivers.
Package: nymea-plugin-zigbee-develco
Architecture: any
Depends: ${shlibs:Depends},
@ -1254,6 +1270,7 @@ Depends: nymea-plugin-anel,
nymea-plugin-keba,
nymea-plugin-unifi,
nymea-plugin-usbrelay,
nymea-plugin-yamahaavr,
nymea-plugins-zigbee,
Description: Plugins for nymea IoT server - the default plugin collection
The nymea daemon is a plugin based IoT (Internet of Things) server. The

View File

@ -0,0 +1,4 @@
yamahaavr/integrationpluginyamahaavr.json usr/lib/@DEB_HOST_MULTIARCH@/nymea/plugins/yamahaavr/
yamahaavr/integrationpluginyamahaavr.py usr/lib/@DEB_HOST_MULTIARCH@/nymea/plugins/yamahaavr/
yamahaavr/zeroconfbrowser.py usr/lib/@DEB_HOST_MULTIARCH@/nymea/plugins/yamahaavr/
yamahaavr/requirements.txt usr/lib/@DEB_HOST_MULTIARCH@/nymea/plugins/yamahaavr/

28
yamahaavr/README.md Normal file
View File

@ -0,0 +1,28 @@
# Yamaha AV Receiver
This plugin allows to control your Yamaha (non-MusicCast) AV receivers.
Each supported receiver on your local area network should appear automatically in the system.
Browsing is supported, but can be slow due to the nature of the Yamaha API.
As a nice extra, a random album on a random server can be started with a simple action.
## Supported Things
* Yamaha RX-V675 (tested)
* Other non-MusicCast Yamaha RX-V devices should also work, but haven't been tested
* Newer Yamaha MusicCast devices aren't supported, as they use a different API
## Manual
* Volumes (and some other variables) are represented by integer in the Yamaha API, but shown as double = int/10 in Yamaha UI, so e.g. API will show -455, but receiver will show -45.5 dB. As the Nymea media interface currently needs volume to be an integer, the plugin will show volume as integer, so e.g. -455 instead of -45.5 dB
* Browsing shortcuts (for browsing a SERVER source) can be added via the Thing settings, to avoid having to go through e.g. ServerName/Music/By Folder/FolderName each time. By adding a "shortcut tree" such as ServerName/Music/By Folder/FolderName to the settings, browsing will start in folder FolderName instead of first showing a list of servers including ServerName; another possibility is e.g. ServerName2/Music/By Album
## Requirements
* nymea and the Yamaha device must be in the same local area network.
* The package "nymea-plugin-yamahaavr" must be installed.
## More
[Yamaha Electronics](https://www.yamaha.com/en/)

View File

@ -0,0 +1,754 @@
{
"displayName": "Yamaha AV receiver",
"name": "Yamaha",
"id": "aa07a5cc-ca65-4043-9e61-e7040a6a60ff",
"vendors": [
{
"id": "07460546-0b4a-4c3c-9143-d5de6b09de71",
"displayName": "Yamaha Corporation",
"name": "yamaha",
"thingClasses": [
{
"id": "f799a98a-8521-451e-a206-4b60e2dd0985",
"name": "receiver",
"displayName": "Yamaha AV Receiver",
"createMethods": ["discovery"],
"interfaces": ["mediaplayer", "mediacontroller", "volumecontroller", "mediametadataprovider", "connectable", "power"],
"browsable": true,
"paramTypes": [
{
"id": "0129f3eb-3cc6-47fa-9366-74194ec655f9",
"name": "serial",
"displayName": "Serial Number",
"type": "QString",
"readOnly": true
}
],
"settingsTypes": [
{
"id": "e7a1e300-f3e9-4b56-a320-ed347409da9c",
"name": "browsingShortcut1",
"displayName": "Browsing shortcut 1 (see readme)",
"type": "QString",
"defaultValue": ""
},
{
"id": "98fea0de-82a5-40af-bd98-35099555c639",
"name": "shortcutLabel1",
"displayName": "Shortcut 1 label",
"type": "QString",
"defaultValue": ""
},
{
"id": "ca923c89-fdf9-4d3d-b1e7-947530450129",
"name": "browsingShortcut2",
"displayName": "Browsing shortcut 2",
"type": "QString",
"defaultValue": ""
},
{
"id": "2aa92119-8a84-4ad0-8115-3e040ce1b54a",
"name": "shortcutLabel2",
"displayName": "Shortcut 2 label",
"type": "QString",
"defaultValue": ""
},
{
"id": "62747f24-f706-4f40-9a3a-28a444125e59",
"name": "browsingShortcut3",
"displayName": "Browsing shortcut 3",
"type": "QString",
"defaultValue": ""
},
{
"id": "bdc440e9-8340-406f-9c86-32fd3795031a",
"name": "shortcutLabel3",
"displayName": "Shortcut 3 label",
"type": "QString",
"defaultValue": ""
},
{
"id": "28549b0d-c006-47ca-b215-3a86b1ed5440",
"name": "browsingShortcut4",
"displayName": "Browsing shortcut 4",
"type": "QString",
"defaultValue": ""
},
{
"id": "e35d5f98-3ea6-488c-af41-a1b7635f1cb3",
"name": "shortcutLabel4",
"displayName": "Shortcut 4 label",
"type": "QString",
"defaultValue": ""
},
{
"id": "ab9e7218-5673-43e1-80a8-d35125dfa5a7",
"name": "browsingShortcut5",
"displayName": "Browsing shortcut 5",
"type": "QString",
"defaultValue": ""
},
{
"id": "15793b6f-e2f6-47c4-96f7-494eac77a61e",
"name": "shortcutLabel5",
"displayName": "Shortcut 5 label",
"type": "QString",
"defaultValue": ""
}
],
"stateTypes": [
{
"id": "ea3ccab0-549a-4174-a6e1-493981cf5fa8",
"name": "connected",
"displayName": "Connected",
"displayNameEvent": "Connected changed",
"defaultValue": false,
"type": "bool",
"cached": false
},
{
"displayName": "Power",
"id": "5b1232a6-4eb5-4e7a-825b-4906de623ea0",
"name": "power",
"displayNameEvent": "Power changed",
"displayNameAction": "Set power",
"type": "bool",
"defaultValue": false,
"writable": true
},
{
"displayName": "Sleep",
"id": "8090c8ea-dea5-45d0-9592-092c50ee4235",
"name": "sleep",
"displayNameEvent": "Sleep timer changed",
"displayNameAction": "Set sleep timer",
"type": "QString",
"writable": true,
"possibleValues": [
"Off",
"30 min",
"60 min",
"90 min",
"120 min"
],
"defaultValue": "Off"
},
{
"displayName": "Mute",
"id": "f36a7bac-313e-4ab2-8816-4d9ce3684414",
"name": "mute",
"displayNameEvent": "Mute changed",
"displayNameAction": "Set mute",
"type": "bool",
"defaultValue": false,
"writable": true
},
{
"displayName": "Volume",
"id": "9734a504-7447-4c82-ba90-d47fbe50a696",
"name": "volume",
"displayNameEvent": "Volume changed",
"displayNameAction": "Set volume",
"type": "int",
"defaultValue": -500,
"minValue": -800,
"maxValue": -100,
"writable": true
},
{
"displayName": "Input Source",
"id": "710949d8-ae7c-4a60-9cfa-a9f0eb2ffbe1",
"name": "inputSource",
"displayNameEvent": "Input source changed",
"displayNameAction": "Set input source",
"type": "QString",
"writable": true,
"possibleValues": [
"TUNER",
"NAPSTER",
"SPOTIFY",
"SERVER",
"AirPlay",
"NET RADIO",
"USB",
"HDMI1",
"HDMI2",
"HDMI3",
"HDMI4",
"HDMI5",
"AV1",
"AV2",
"AV3",
"AV4",
"AV5",
"AV6",
"V-AUX",
"AUDIO1",
"AUDIO2"
],
"defaultValue": "HDMI1"
},
{
"displayName": "Surround Program",
"id": "1a9b6260-e71b-4750-bf03-34bca0b34222",
"name": "surroundMode",
"displayNameEvent": "Surround program changed",
"displayNameAction": "Set surround program",
"type": "QString",
"writable": true,
"possibleValues": [
"Standard",
"2ch Stereo",
"7ch Stereo",
"Straight",
"Surround Decoder",
"Sci-Fi",
"Adventure",
"Drama",
"Spectacle",
"Mono Movie",
"Music Video",
"Roleplaying Game",
"Action Game",
"Sports",
"Hall in Munich",
"Hall in Vienna",
"Chamber",
"Cellar Club",
"The Roxy Theatre",
"The Bottom Line"
],
"defaultValue": "Standard"
},
{
"displayName": "Bass",
"id": "07b2c6ae-74c6-4cb2-b434-a25ad90fb7f9",
"name": "bass",
"displayNameEvent": "Bass changed",
"displayNameAction": "Set bass",
"type": "int",
"defaultValue": 0,
"minValue": -60,
"maxValue": 60,
"writable": true
},
{
"displayName": "Treble",
"id": "c06bce86-c1cb-42f0-9891-161a7f0849f5",
"name": "treble",
"displayNameEvent": "Treble changed",
"displayNameAction": "Set treble",
"type": "int",
"defaultValue": 0,
"minValue": -60,
"maxValue": 60,
"writable": true
},
{
"displayName": "Subwoofer Trim",
"id": "8b77db08-9a94-466c-8a57-b7cd8e638a80",
"name": "subwooferTrim",
"displayNameEvent": "Subwoofer trim changed",
"displayNameAction": "Set subwoofer Trim",
"type": "int",
"defaultValue": 0,
"minValue": -60,
"maxValue": 60,
"writable": true
},
{
"displayName": "Pure direct",
"id": "d19ddece-6bf5-4c2d-9bbc-018b02d564df",
"name": "pureDirect",
"displayNameEvent": "Pure direct changed",
"displayNameAction": "Set pure direct",
"type": "bool",
"defaultValue": false,
"writable": true
},
{
"displayName": "Enhancer",
"id": "ca7a4564-9f6d-4f07-8f63-445e44a0eb93",
"name": "enhancer",
"displayNameEvent": "Enhancer changed",
"displayNameAction": "Set enhancer",
"type": "bool",
"defaultValue": false,
"writable": true
},
{
"displayName": "Cinema DSP 3D",
"id": "8504e78f-924b-492f-8cc7-69290fb29c95",
"name": "cinemaDSP3D",
"displayNameEvent": "Cinema DSP 3D changed",
"displayNameAction": "Set Cinema DSP 3D",
"type": "QString",
"writable": true,
"possibleValues": [
"Off",
"Auto"
],
"defaultValue": "Auto"
},
{
"displayName": "Adaptive DRC",
"id": "99057bc6-4d2a-4670-a1c7-02e9e869b86b",
"name": "adaptiveDRC",
"displayNameEvent": "Adaptive DRC changed",
"displayNameAction": "Set Adaptive DRC",
"type": "QString",
"writable": true,
"possibleValues": [
"Off",
"Auto"
],
"defaultValue": "Auto"
},
{
"displayName": "Dialogue level",
"id": "042ed95f-d0f7-4eda-b469-a7863a639e84",
"name": "dialogueLevel",
"displayNameEvent": "Dialogue level changed",
"displayNameAction": "Set dialogue level",
"type": "int",
"defaultValue": 0,
"minValue": 0,
"maxValue": 3,
"writable": true
},
{
"displayName": "Dialogue lift",
"id": "3eff11b2-f6b0-4180-aadc-ef77fca633f4",
"name": "dialogueLift",
"displayNameEvent": "Dialogue lift changed",
"displayNameAction": "Set dialogue lift",
"type": "int",
"defaultValue": 0,
"minValue": 0,
"maxValue": 5,
"writable": true
},
{
"id": "053c01cd-4696-490b-91ad-480cd90171e0",
"name": "artist",
"displayName": "Artist",
"displayNameEvent": "Artist changed",
"type": "QString",
"defaultValue": ""
},
{
"id": "3db27780-b0a0-409e-9986-2c751f0bb9d8",
"name": "collection",
"displayName": "Album",
"displayNameEvent": "Album changed",
"type": "QString",
"defaultValue": ""
},
{
"id": "1686f85c-ce71-474b-8ece-e8da97fb809b",
"name": "title",
"displayName": "Title",
"displayNameEvent": "Title changed",
"type": "QString",
"defaultValue": ""
},
{
"id": "e321c171-b0c1-486f-a245-b4fd8ddf90e3",
"name": "artwork",
"displayName": "Artwork",
"displayNameEvent": "Artwork changed",
"type": "QString",
"defaultValue": ""
},
{
"id": "f936b76f-657d-467a-90c0-cbdf08de2201",
"name": "playerType",
"displayName": "Player type",
"displayNameEvent": "Player type changed",
"possibleValues": [
"audio",
"video"
],
"type": "QString",
"defaultValue": "audio"
},
{
"id": "f5a12603-5df9-4eae-9096-17775272d22f",
"name": "playbackStatus",
"displayName": "Playback status",
"displayNameEvent": "Playback status changed",
"displayNameAction": "Set playback status",
"type": "QString",
"defaultValue": "Stopped",
"possibleValues": ["Playing", "Paused", "Stopped"],
"cached": false,
"writable": true
},
{
"id": "189600dd-6cdc-4453-a816-f897b8ef06dd",
"name": "shuffle",
"displayName": "Shuffle",
"displayNameEvent": "Shuffle changed",
"displayNameAction": "Set shuffle",
"type": "bool",
"defaultValue": false,
"cached": false,
"writable": true
},
{
"id": "fa5e8258-ce4c-4afa-b8bc-9c3c2be7653b",
"name": "repeat",
"displayName": "Repeat mode",
"displayNameEvent": "Repeat mode changed",
"displayNameAction": "Set repeat mode",
"type": "QString",
"defaultValue": "None",
"possibleValues": ["None", "One", "All"],
"cached": false,
"writable": true
},
{
"id": "b269c1f4-1881-461d-810b-b594de499490",
"name": "url",
"displayName": "Device Address",
"displayNameEvent": "Device IP changed",
"defaultValue": "0.0.0.0",
"type" : "QString"
}
],
"actionTypes": [
{
"id": "671abe60-b8a5-48cd-a138-9f4283a823d2",
"name": "randomAlbum",
"displayName": "Play Random Album"
},
{
"id": "dd1a44d1-ecb2-4752-a8d4-f3960dec6808",
"displayName": "Increase volume",
"name": "increaseVolume",
"paramTypes": [
{
"id": "3bb5ff93-a787-4a30-957e-b96f27da2199",
"name": "step",
"displayName": "Step size",
"type": "uint",
"minValue": 1,
"maxValue": 5,
"defaultValue": 5
}
]
},
{
"id": "d3752c32-92e3-4396-8e2f-ab5e57c6cfb1",
"displayName": "Decrease volume",
"name": "decreaseVolume",
"paramTypes": [
{
"id": "736f5e25-31ce-4d17-80ab-b82b18cf6540",
"name": "step",
"displayName": "Step size",
"type": "uint",
"minValue": 1,
"maxValue": 5,
"defaultValue": 5
}
]
},
{
"id": "9d1812ba-77a6-493a-8fd0-77a6c44d3765",
"name": "skipBack",
"displayName": "Skip back"
},
{
"id": "c5a8d2e0-60d8-4092-ae77-697b13ce5946",
"name": "stop",
"displayName": "Stop"
},
{
"id": "18e999ae-a1ef-476e-a416-05b8b07527ae",
"name": "play",
"displayName": "Play"
},
{
"id": "9f019a46-821a-4069-9772-fc649c39f941",
"name": "pause",
"displayName": "Pause"
},
{
"id": "ffceeb31-8b66-4d03-b664-57a3f9c9ec1a",
"name": "skipNext",
"displayName": "Skip next"
}
],
"browserItemActionTypes": [
{
"id": "24e8955e-4a51-411b-863d-aa70c2ab90ef",
"name": "playRandom",
"displayName": "Play random album"
}
]
},
{
"id": "664ba198-a3e2-4380-83f3-adfb22a13130",
"name": "zone",
"displayName": "Yamaha AV Receiver Zone",
"createMethods": ["discovery"],
"interfaces": ["mediaplayer", "mediacontroller", "volumecontroller", "mediametadataprovider", "connectable", "power"],
"browsable": true,
"paramTypes": [
{
"id": "9abc9961-0582-4b31-8f28-6659a3434352",
"name": "serial",
"displayName": "Serial Number",
"type" : "QString",
"readOnly": true
},
{
"id": "6cfafac2-4aa5-4e73-b06e-550f4f66bc6a",
"name": "zoneId",
"displayName": "Zone number",
"type" : "int",
"readOnly": true
}
],
"settingsTypes": [
],
"stateTypes": [
{
"id": "30c97665-1843-46d5-9091-06d97f456827",
"name": "connected",
"displayName": "Connected",
"displayNameEvent": "Connected changed",
"defaultValue": false,
"type": "bool",
"cached": false
},
{
"displayName": "Power",
"id": "bcace3de-902e-4361-8be3-68e0e42cb729",
"name": "power",
"displayNameEvent": "Power changed",
"displayNameAction": "Set power",
"type": "bool",
"defaultValue": false,
"writable": true
},
{
"displayName": "Sleep",
"id": "7ac5101f-96cd-40f4-a565-a15c266dafdb",
"name": "sleep",
"displayNameEvent": "Sleep timer changed",
"displayNameAction": "Set sleep timer",
"type": "QString",
"writable": true,
"possibleValues": [
"Off",
"30 min",
"60 min",
"90 min",
"120 min"
],
"defaultValue": "Off"
},
{
"displayName": "Mute",
"id": "26ac1df0-77c7-4461-95a5-294ce629ad5a",
"name": "mute",
"displayNameEvent": "Mute changed",
"displayNameAction": "Set mute",
"type": "bool",
"defaultValue": false,
"writable": true
},
{
"displayName": "Volume",
"id": "090ade12-ade2-43df-9d47-3d0cfc7c1def",
"name": "volume",
"displayNameEvent": "Volume changed",
"displayNameAction": "Set volume",
"type": "int",
"defaultValue": -500,
"minValue": -800,
"maxValue": -100,
"writable": true
},
{
"displayName": "Input Source",
"id": "40de91af-6c09-4a72-8812-bdff354917d9",
"name": "inputSource",
"displayNameEvent": "Input source changed",
"displayNameAction": "Set input source",
"type": "QString",
"writable": true,
"possibleValues": [
"TUNER",
"NAPSTER",
"SPOTIFY",
"SERVER",
"AirPlay",
"NET RADIO",
"USB",
"AV5",
"AV6",
"AUDIO1",
"AUDIO2"
],
"defaultValue": "SERVER"
},
{
"id": "14288bcb-be26-43a9-895a-f519fea47e62",
"name": "artist",
"displayName": "Artist",
"displayNameEvent": "Artist changed",
"type": "QString",
"defaultValue": ""
},
{
"id": "330e5570-586c-44bb-87ee-58d37d139985",
"name": "collection",
"displayName": "Album",
"displayNameEvent": "Album changed",
"type": "QString",
"defaultValue": ""
},
{
"id": "dfb1fac7-8a2e-42d3-b2f3-badb1c80be5c",
"name": "title",
"displayName": "Title",
"displayNameEvent": "Title changed",
"type": "QString",
"defaultValue": ""
},
{
"id": "5bb9d082-4c22-49c1-8b03-94aab00b0b97",
"name": "artwork",
"displayName": "Artwork",
"displayNameEvent": "Artwork changed",
"type": "QString",
"defaultValue": ""
},
{
"id": "eca64246-b1a6-4204-b0ce-fc800b8135d7",
"name": "playerType",
"displayName": "Player type",
"displayNameEvent": "Player type changed",
"possibleValues": [
"audio",
"video"
],
"type": "QString",
"defaultValue": "audio"
},
{
"id": "03a1005e-91be-4c09-869d-4a90ba7c6fca",
"name": "playbackStatus",
"displayName": "Playback status",
"displayNameEvent": "Playback status changed",
"displayNameAction": "Set playback status",
"type": "QString",
"defaultValue": "Stopped",
"possibleValues": ["Playing", "Paused", "Stopped"],
"cached": false,
"writable": true
},
{
"id": "7444ed1e-952c-4d33-9673-bcc599ffb52a",
"name": "shuffle",
"displayName": "Shuffle",
"displayNameEvent": "Shuffle changed",
"displayNameAction": "Set shuffle",
"type": "bool",
"defaultValue": false,
"cached": false,
"writable": true
},
{
"id": "d03b4144-46fe-47ba-a287-3408b1dc3c54",
"name": "repeat",
"displayName": "Repeat mode",
"displayNameEvent": "Repeat mode changed",
"displayNameAction": "Set repeat mode",
"type": "QString",
"defaultValue": "None",
"possibleValues": ["None", "One", "All"],
"cached": false,
"writable": true
}
],
"actionTypes": [
{
"id": "7ffbe00e-b5e6-4602-9c1c-7319c0fc3257",
"name": "randomAlbum",
"displayName": "Play Random Album"
},
{
"id": "ed011bda-7b52-4ba1-a99e-60ddf31bc859",
"displayName": "Increase volume",
"name": "increaseVolume",
"paramTypes": [
{
"id": "065d7fc4-5819-49f6-917e-18fbef84e24e",
"name": "step",
"displayName": "Step size",
"type": "uint",
"minValue": 1,
"maxValue": 5,
"defaultValue": 5
}
]
},
{
"id": "e753b540-c7d3-4f54-8078-e261ebf0bcbe",
"displayName": "Decrease volume",
"name": "decreaseVolume",
"paramTypes": [
{
"id": "e5ee7aaa-ed67-4807-8941-0aa8266c4951",
"name": "step",
"displayName": "Step size",
"type": "uint",
"minValue": 1,
"maxValue": 5,
"defaultValue": 5
}
]
},
{
"id": "ac22babd-b72a-48bb-913a-e47982c5bff9",
"name": "skipBack",
"displayName": "Skip back"
},
{
"id": "d8eab201-27bc-4850-bbaa-be91e58cd874",
"name": "stop",
"displayName": "Stop"
},
{
"id": "fe30284b-6863-4319-b71e-db18c0b1e2f3",
"name": "play",
"displayName": "Play"
},
{
"id": "2568ac35-d051-442f-877d-a359129b3164",
"name": "pause",
"displayName": "Pause"
},
{
"id": "e691da7c-ed1d-4b09-b60a-41a7fcd89e49",
"name": "skipNext",
"displayName": "Skip next"
}
],
"browserItemActionTypes": [
{
"id": "161ae3ac-efb1-460e-9564-c175bbf68861",
"name": "playRandom",
"displayName": "Play random album"
}
]
}
]
}
]
}

File diff suppressed because it is too large Load Diff

13
yamahaavr/meta.json Normal file
View File

@ -0,0 +1,13 @@
{
"title": "Yamaha AV receiver",
"tagline": "Connect to and control your (non-Musiccast) Yamaha AV receivers",
"icon": "yamaha.png",
"stability": "consumer",
"offline": true,
"technologies": [
"network"
],
"categories": [
"multimedia"
]
}

View File

@ -0,0 +1,64 @@
zeroconf==0.29.0 \
--hash=sha256:7aefbb658b452b1fd7e51124364f938c6f5e42d6ea893fa2557bea8c06c540af \
--hash=sha256:85fdeeef88b08965ab87559177457cfdb5dd2e4bc62a476208c2473a51dfa0b2
testresources==2.0.1 \
--hash=sha256:67a361c3a2412231963b91ab04192209aa91a1aa052f0ab87245dbea889d1282 \
--hash=sha256:ee9d1982154a1e212d4e4bac6b610800bfb558e4fb853572a827bc14a96e4417
requests==2.25.1 \
--hash=sha256:27973dd4a904a4f13b263a19c866c13b92a39ed1c964655f025f3f8d3d75b804 \
--hash=sha256:c210084e36a42ae6b9219e00e48287def368a26d03a048ddad7bfee44f75871e
urllib3==1.26.3 \
--hash=sha256:1b465e494e3e0d8939b50680403e3aedaa2bc434b7d5af64dfd3c958d7f5ae80 \
--hash=sha256:de3eedaad74a2683334e282005cd8d7f22f4d55fa690a2a1020a416cb0a47e73
chardet==4.0.0 \
--hash=sha256:0d6f53a15db4120f2b08c94f11e7d93d2c911ee118b6b30a04ec3ee8310179fa \
--hash=sha256:f864054d66fd9118f2e67044ac8981a54775ec5b67aed0441892edb553d21da5
lazr.uri==1.0.5 \
--hash=sha256:f36e7e40d5f8f2cf20ff2c81784a14a546e6c19c216d40a6617ebe0c96c92c49 \
--hash=sha256:71f2faf04b148cf63d78da08ee5d8d6a7a7dbda8c9016b389a16f790d080c06f
six==1.15.0 \
--hash=sha256:30639c035cdb23534cd4aa2dd52c3bf48f06e5f4a941509c8bafd8ce11080259 \
--hash=sha256:8b74bedcbbbaca38ff6d7491d76f2b06b3592611af620f8426e82dddb04a5ced
wadllib==1.3.5 \
--hash=sha256:84fecbaec2fef5ae2d7717a8115d271f18c6b5441eac861c58be8ca57f63c1d3 \
--hash=sha256:67d3102b40eefdd6c3007cfbcc4c07f6948fec0666ba5c17d703eab21f054692
lazr.restfulclient==0.14.3 \
--hash=sha256:9f28bbb7c00374159376bd4ce36b4dacde7c6b86a0af625aa5e3ae214651a690 \
--hash=sha256:2320e6d132c9a5148895e85be03274bc9305e4605439b03541ee3a618e00fb94
pyparsing==2.4.7 \
--hash=sha256:c203ec8783bf771a155b207279b9bccb8dea02d8f0c9e5f8ead507bc3246ecc1 \
--hash=sha256:ef9d7589ef3c200abe66653d3f1ab1033c3c419ae9b9bdb1240a85b024efc88b
idna==2.5 \
--hash=sha256:3cb5ce08046c4e3a560fc02f138d0ac63e00f8ce5901a56b32ec8b7994082aab \
--hash=sha256:cc19709fd6d0cbfed39ea875d29ba6d4e22c0cebc510a76d6302a28385e8bb70
certifi==2020.12.5 \
--hash=sha256:1a4995114262bffbc2413b159f2a1a480c969de6e6eb13ee966d470af86af59c \
--hash=sha256:719a74fb9e33b9bd44cc7f3a8d94bc35e4049deebe19ba7d8e108280cfd59830
setuptools==54.1.1 \
--hash=sha256:1ce82798848a978696465866bb3aaab356003c42d6143e1111fcf069ac838274 \
--hash=sha256:75c5c4479f4961f1ffdb597c98aa4e4077e6813685025e8bdebf7598aa84e859
pbr==5.5.1 \
--hash=sha256:5fad80b613c402d5b7df7bd84812548b2a61e9977387a80a5fc5c396492b13c9 \
--hash=sha256:b236cde0ac9a6aedd5e3c34517b423cd4fd97ef723849da6b0d2231142d89c00
distro==1.5.0 \
--hash=sha256:0e58756ae38fbd8fc3020d54badb8eae17c5b9dcbed388b17bb55b8a5928df92 \
--hash=sha256:df74eed763e18d10d0da624258524ae80486432cd17392d9c3d96f5e83cd2799
oauthlib==3.1.0 \
--hash=sha256:bee41cc35fcca6e988463cacc3bcb8a96224f470ca547e697b604cc697b2f889 \
--hash=sha256:df884cd6cbe20e32633f1db1072e9356f53638e4361bef4e8b03c9127c9328ea
requests-oauthlib==1.3.0 \
--hash=sha256:7f71572defaecd16372f9006f33c2ec8c077c3cfa6f5911a9a90202beb513f3d \
--hash=sha256:b4261601a71fd721a8bd6d7aa1cc1d6a8a93b4a9f5e96626f8e4d91e8beeaa6a \
--hash=sha256:fa6c47b933f01060936d87ae9327fead68768b69c6c9ea2109c48be30f2d4dbc
urllib3==1.26.3 \
--hash=sha256:1b465e494e3e0d8939b50680403e3aedaa2bc434b7d5af64dfd3c958d7f5ae80 \
--hash=sha256:de3eedaad74a2683334e282005cd8d7f22f4d55fa690a2a1020a416cb0a47e73
chardet==4.0.0 \
--hash=sha256:0d6f53a15db4120f2b08c94f11e7d93d2c911ee118b6b30a04ec3ee8310179fa \
--hash=sha256:f864054d66fd9118f2e67044ac8981a54775ec5b67aed0441892edb553d21da5
httplib2==0.19.0 \
--hash=sha256:749c32603f9bf16c1277f59531d502e8f1c2ca19901ae653b49c4ed698f0820e \
--hash=sha256:e0d428dad43c72dbce7d163b7753ffc7a39c097e6788ef10f4198db69b92f08e
ifaddr==0.1.7 \
--hash=sha256:1f9e8a6ca6f16db5a37d3356f07b6e52344f6f9f7e806d618537731669eb1a94 \
--hash=sha256:d1f603952f0a71c9ab4e705754511e4e03b02565bc4cec7188ad6415ff534cd3

BIN
yamahaavr/yamaha.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -0,0 +1,74 @@
import time
from zeroconf import IPVersion, ServiceBrowser, ServiceInfo, Zeroconf
from typing import Callable, List
class ZeroconfDevice(object):
# To do: replace with nymea serviceBrowser
def __init__(self, name: str, ip: str, port: int, model: str, id: str) -> None:
self.name = name
self.ip = ip
self.port = port
self.model = model
self.id = id
def __repr__(self) -> str:
return f"{type(self).__name__}({self.__dict__})"
def __eq__(self, other) -> bool:
return self is other or self.__dict__ == other.__dict__
class ZeroconfListener(object):
# To do: replace with nymea serviceBrowser
"""Basic zeroconf listener."""
def __init__(self, func: Callable[[ServiceInfo], None]) -> None:
"""Initialize zeroconf listener with function callback."""
self._func = func
def __repr__(self) -> str:
return f"{type(self).__name__}({self.__dict__})"
def __eq__(self, other) -> bool:
return self is other or self.__dict__ == other.__dict__
def add_service(self, zeroconf: Zeroconf, type: str, name: str) -> None:
"""Callback function when zeroconf service is discovered."""
self._func(zeroconf.get_service_info(type, name))
def update_service(self, zeroconf: Zeroconf, type: str, name: str) -> None:
return
def remove_service(self, zeroconf: Zeroconf, type: str, name: str) -> None:
return
def discover(service_type: str, timeout: int = 5) -> List[ZeroconfDevice]:
# To do: replace with nymea serviceBrowser
"""From pyvizio: Return all discovered zeroconf services of a given service type over given timeout period."""
services = []
def append_service(info: ServiceInfo) -> None:
"""Append discovered zeroconf service to service list."""
name = info.name[: -(len(info.type) + 1)]
ip = info.parsed_addresses(IPVersion.V4Only)[0]
port = info.port
model = info.properties.get(b"name", "")
id = info.properties.get(b"id")
# handle id decode for various discovered use cases
if isinstance(id, bytes):
try:
int(id, 16)
except Exception:
id = id.hex()
else:
id = None
service = ZeroconfDevice(name, ip, port, model, id)
services.append(service)
zeroconf = Zeroconf()
ServiceBrowser(zeroconf, service_type, ZeroconfListener(append_service))
time.sleep(timeout)
zeroconf.close()
return services