This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Yamaha Extended Control
#1
Hi,

I can send HTTP a request to the Yamaha controller.

http://ip_address/YamahaExtendedControl/.../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?
Reply
#2
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
Reply
#3
thanks.
Reply
#4
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.
Reply
#5
Try using the volume value directly. Also you should use different objects for status and control.
Code:
grp.checkupdate('1/1/3', status.volume)
Reply


Forum Jump: