Logic Machine Forum
Yamaha Extended Control - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: Yamaha Extended Control (/showthread.php?tid=3602)



Yamaha Extended Control - akn - 04.10.2021

Hi,

I can send HTTP a request to the Yamaha controller.

http://ip_address/YamahaExtendedControl/v1/main/getStatus

After the request, I receive an answer. For example when "power": "ON", the controller is on, and when "power": "standby" the controller is off.

{"response_code":0,"power":"standby","sleep":0,"volume":100,"mute":false,"max_volume":161,"input":"airplay","input_text":"AirPlay","distribution_enable":false,"enhancer":true,"equalizer":{"mode":"auto","low":0,"mid":0,"high":0},"bass_extension":false,"link_control":"standard","link_audio_delay":"balanced","disable_flags":0,"actual_volume":{"mode":"db","value":-30.5,"unit":"dB"},"mono":false}

Tell me how I can convert the received data to the KNX?


RE: Yamaha Extended Control - admin - 05.10.2021

Use this as a starting point. response variable should contain your HTTP request result.

Code:
status = require('json').pdecode(response)

if type(status) == 'table' then
  poweron = status.power ~= 'standby'
  grp.checkupdate('1/1/1', poweron) -- power status (1 bit)

  grp.checkupdate('1/1/2', status.input_text) -- input (text)

  volume = status.volume / status.max_volume * 100
  grp.checkupdate('1/1/3', volume) -- current volume (1 byte scale)
end



RE: Yamaha Extended Control - akn - 05.10.2021

thanks.


RE: Yamaha Extended Control - akn - 07.10.2021

Volume status problem!

volume = status.volume / status.max_volume * 100
  grp.checkupdate('1/1/3', volume) -- current volume (1 byte scale)

The volume volume status is 100 but received volume value is 61
Therefore, the script is constantly updating the value.


RE: Yamaha Extended Control - admin - 07.10.2021

Try using the volume value directly. Also you should use different objects for status and control.
Code:
grp.checkupdate('1/1/3', status.volume)