Since the Yamah plugin is not working anymore ( :'() i'm trying to do that i wan't with virtual switch and dzvents.
but i'm a sysadmin not a developer so difficult for me.
So can anyone help me to do 2 simple things please ?
that i wan't :
- a timer trigger that check the yamaha amp status and change the virtual switch (dimmer) according to amp status.
- change volume of amp when i change it on the dimmer virtual switch.
- change the dimmer volume according to amp volume
- add a selector to switch betweens input (and change it when input is changed directly on amp)
The amp work with http GET (and some POST) and return JSON.
for example in order to get status :
curl -s http://ampli-salon/YamahaExtendedContro ... /getStatus
return :
{"response_code":0,"power":"standby","sleep":0,"volume":76,"mute":false,"max_volume":161,"input":"hdmi5","distribution_enable":true,"sound_program":"surr_decoder","surr_decoder_type":"dts_neo6_cinema","direct":false,"enhancer":true,"tone_control":{"mode":"manual","bass":3,"treble":0},"link_control":"standard","link_audio_delay":"audio_sync","link_audio_quality":"uncompressed","disable_flags":0,"actual_volume":{"mode":"db","value":-42.5,"unit":"dB"},"contents_display":false}
so the interesting value are :
.power (standby or on)
.volume
.input
so i started by creating a event in domoticz UI using http request
Code: Select all
return {
on = {
timer = {
'every 1 minutes' -- just an example to trigger the request
},
httpResponses = {
'trigger' -- must match with the callback passed to the openURL command
}
},
execute = function(domoticz, item)
if (item.isTimer) then
domoticz.openURL({
url = 'http://ampli-salon/YamahaExtendedControl/v1/main/getStatus',
method = 'GET',
callback = 'trigger', -- see httpResponses above.
})
end
if (item.isHTTPResponse) then
if (item.ok) then
if (item.isJSON) then
local status = item.json.power -- just an example
-- update some device in Domoticz
domoticz.devices('Ampli - Zone 1').updateText(someValue)
end
else
domoticz.log('There was a problem handling the request', domoticz.LOG_ERROR)
domoticz.log(item, domoticz.LOG_ERROR)
end
end
end
}
Thanks i advance