Page 1 of 2
Get data from swith to text in dummy switch
Posted: Friday 30 October 2020 14:33
by madpatrick
Hi
Is it possible to get the info from a switch and put this as a text in a dummy switch ?
What i want is to have the information from the LMS switch and get this displayed in a text blok.
I only need the data and not the rest of this block to put this in my screensaver of Dashticz
Re: Get data from swith to text in dummy switch
Posted: Friday 30 October 2020 15:28
by waaren
madpatrick wrote:
What i want is to have the information from the LMS switch and get this displayed in a text blok.
What kind of info and what is an LMS switch?
Re: Get data from swith to text in dummy switch
Posted: Friday 30 October 2020 15:34
by madpatrick
Hi Waaren,
The LMS switch in the Logitech Media Server
The info the song that is played.

Re: Get data from swith to text in dummy switch
Posted: Saturday 31 October 2020 19:54
by waaren
madpatrick wrote: ↑Friday 30 October 2020 15:34
Hi Waaren,
The LMS switch in the Logitech Media Server
The info the song that is played.
What is the device type and subtype of this switch (as shown on the devices tab ?)
Re: Get data from swith to text in dummy switch
Posted: Saturday 31 October 2020 20:25
by madpatrick
Hi Waaren,
Please see the screenshot

What is want to display is "Data"-field.
This is the song currently played
Re: Get data from swith to text in dummy switch
Posted: Saturday 31 October 2020 21:01
by waaren
madpatrick wrote: ↑Saturday 31 October 2020 20:25
What is want to display is "Data"-field.
This is the song currently played
Don't know if it is possible but can you set below script, change a song and share the log? That might help to see if it is possible.
Code: Select all
return
{
on =
{
devices =
{
430,
},
},
execute = function(dz, item)
item.dump()
dz.log('-------------- rawData' ,dz.LOG_FORCEI)
dz.log(item.rawData, dz.LOG_FORCE)
end
}
Re: Get data from swith to text in dummy switch
Posted: Saturday 31 October 2020 21:11
by madpatrick
It is a lot of information, but i'll just post it
Code: Select all
2020-10-31 21:04:12.026 Logitech Media Server: (Squeezebox Touch) Playing - 'Jaki Graham - Set Me Free'
2020-10-31 21:04:12.125 Status: dzVents: > setKelvin()
2020-10-31 21:04:12.125 Status: dzVents: > switchType: Media Player
2020-10-31 21:04:12.125 Status: dzVents: > idx: 430
2020-10-31 21:04:12.125 Status: dzVents: > usedByCamera: false
2020-10-31 21:04:12.125 Status: dzVents: > incrementCounter()
2020-10-31 21:04:12.125 Status: dzVents: > switchOn()
2020-10-31 21:04:12.125 Status: dzVents: > updateHumidity()
2020-10-31 21:04:12.125 Status: dzVents: > kodiPlayPlaylist()
2020-10-31 21:04:12.125 Status: dzVents: > rename()
2020-10-31 21:04:12.125 Status: dzVents: > hardwareTypeValue: 60
2020-10-31 21:04:12.125 Status: dzVents: > isSecurity: false
2020-10-31 21:04:12.125 Status: dzVents: > bState: true
2020-10-31 21:04:12.125 Status: dzVents: > reset()
2020-10-31 21:04:12.125 Status: dzVents: > unit: 1
2020-10-31 21:04:12.125 Status: dzVents: > setLevel()
2020-10-31 21:04:12.125 Status: dzVents: > updateCounter()
2020-10-31 21:04:12.125 Status: dzVents: > kodiPause()
2020-10-31 21:04:12.125 Status: dzVents: > deviceId: 0000002
2020-10-31 21:04:12.125 Status: dzVents: > updateBarometer()
2020-10-31 21:04:12.125 Status: dzVents: > disarm()
2020-10-31 21:04:12.125 Status: dzVents: > updateWind()
2020-10-31 21:04:12.125 Status: dzVents: > updateSoilMoisture()
2020-10-31 21:04:12.125 Status: dzVents: > decreaseBrightness()
2020-10-31 21:04:12.125 Status: dzVents: > updateElectricity()
2020-10-31 21:04:12.125 Status: dzVents: > id: 430
2020-10-31 21:04:12.125 Status: dzVents: > hardwareType: Logitech Media Server
2020-10-31 21:04:12.125 Status: dzVents: > deviceType: Lighting 2
2020-10-31 21:04:12.125 Status: dzVents: > armAway()
2020-10-31 21:04:12.125 Status: dzVents: > updateTempHumBaro()
2020-10-31 21:04:12.125 Status: dzVents: > switchOff()
2020-10-31 21:04:12.125 Status: dzVents: > isGroup: false
2020-10-31 21:04:12.125 Status: dzVents: > kodiPlay()
2020-10-31 21:04:12.125 Status: dzVents: > _nValue: 7
2020-10-31 21:04:12.125 Status: dzVents: > maxDimLevel: 15
2020-10-31 21:04:12.125 Status: dzVents: > name: Squeezebox Touch
2020-10-31 21:04:12.125 Status: dzVents: > isTimer: false
2020-10-31 21:04:12.125 Status: dzVents: > quietOff()
2020-10-31 21:04:12.125 Status: dzVents: > switchSelector()
2020-10-31 21:04:12.125 Status: dzVents: > updateSoundLevel()
2020-10-31 21:04:12.125 Status: dzVents: > _state: Playing
2020-10-31 21:04:12.125 Status: dzVents: > updateVisibility()
2020-10-31 21:04:12.125 Status: dzVents: > _adapters:
2020-10-31 21:04:12.125 Status: dzVents: > 1: Logitech Media Server device
2020-10-31 21:04:12.125 Status: dzVents: > 2: Switch device adapter
2020-10-31 21:04:12.125 Status: dzVents: > lastLevel: 0
2020-10-31 21:04:12.125 Status: dzVents: > volumeUp()
2020-10-31 21:04:12.125 Status: dzVents: > changed: true
2020-10-31 21:04:12.125 Status: dzVents: > updateVoltage()
2020-10-31 21:04:12.125 Status: dzVents: > volumeDown()
2020-10-31 21:04:12.125 Status: dzVents: > setHue()
2020-10-31 21:04:12.125 Status: dzVents: > updateGas()
2020-10-31 21:04:12.125 Status: dzVents: > updateYouless()
2020-10-31 21:04:12.125 Status: dzVents: > playlistID: 0
2020-10-31 21:04:12.125 Status: dzVents: > updateCustomSensor()
2020-10-31 21:04:12.125 Status: dzVents: > setDescription()
2020-10-31 21:04:12.125 Status: dzVents: > setVolume()
2020-10-31 21:04:12.125 Status: dzVents: > sValue: Playing
2020-10-31 21:04:12.125 Status: dzVents: > updateTempBaro()
2020-10-31 21:04:12.125 Status: dzVents: > kodiExecuteAddOn()
2020-10-31 21:04:12.125 Status: dzVents: > timedOut: false
2020-10-31 21:04:12.126 Status: dzVents: > updateTemperature()
2020-10-31 21:04:12.126 Status: dzVents: > updateSetPoint()
2020-10-31 21:04:12.126 Status: dzVents: > isHTTPResponse: false
2020-10-31 21:04:12.126 Status: dzVents: > switchTypeValue: 17
2020-10-31 21:04:12.126 Status: dzVents: > updateWaterflow()
2020-10-31 21:04:12.126 Status: dzVents: > kodiSetVolume()
2020-10-31 21:04:12.126 Status: dzVents: > description:
2020-10-31 21:04:12.126 Status: dzVents: > updateRain()
2020-10-31 21:04:12.126 Status: dzVents: > increaseBrightness()
2020-10-31 21:04:12.126 Status: dzVents: > setNightMode()
2020-10-31 21:04:12.126 Status: dzVents: > updateMode()
2020-10-31 21:04:12.126 Status: dzVents: > updateLux()
2020-10-31 21:04:12.126 Status: dzVents: > kodiPlayFavorites()
2020-10-31 21:04:12.126 Status: dzVents: > toggleSwitch()
2020-10-31 21:04:12.126 Status: dzVents: > open()
2020-10-31 21:04:12.126 Status: dzVents: > state: Playing
2020-10-31 21:04:12.126 Status: dzVents: > updatePercentage()
2020-10-31 21:04:12.126 Status: dzVents: > updateAlertSensor()
2020-10-31 21:04:12.126 Status: dzVents: > updateP1()
2020-10-31 21:04:12.126 Status: dzVents: > hardwareID: 21
2020-10-31 21:04:12.126 Status: dzVents: > protectionOn()
2020-10-31 21:04:12.126 Status: dzVents: > levelVal: 0
2020-10-31 21:04:12.126 Status: dzVents: > updateWetness()
2020-10-31 21:04:12.126 Status: dzVents: > getColor()
2020-10-31 21:04:12.126 Status: dzVents: > rawData:
2020-10-31 21:04:12.126 Status: dzVents: > 1: Jaki Graham - Set Me Free
2020-10-31 21:04:12.126 Status: dzVents: > setValues()
2020-10-31 21:04:12.126 Status: dzVents: > updateDistance()
2020-10-31 21:04:12.126 Status: dzVents: > baseType: device
2020-10-31 21:04:12.126 Status: dzVents: > protectionOff()
2020-10-31 21:04:12.126 Status: dzVents: > dump()
2020-10-31 21:04:12.126 Status: dzVents: > hardwareId: 21
2020-10-31 21:04:12.126 Status: dzVents: > icon: LogitechMediaServer
2020-10-31 21:04:12.126 Status: dzVents: !Info: {"Jaki Graham - Set Me Free"}
2020-10-31 21:04:12.126 Status: dzVents: Info: ------ Finished LMS
2020-10-31 21:05:00.272 Status: dzVents: Info: ------ Start internal script: Toon_script:, trigger: "every minute"
2020-10-31 21:05:00.399 Status: dzVents: Info: ------ Finished Toon_script
2020-10-31 21:05:00.404 Status: LUA: (Buienradar) Get data from Buienradar
2020-10-31 21:05:12.171 Logitech Media Server: (Squeezebox Touch) Playing - 'Calvin Harris & Sam Smith - Promises'
The song that were played:
Code: Select all
2020-10-31 21:03:51.634 Logitech Media Server: (Squeezebox Touch) On
2020-10-31 21:04:12.026 Logitech Media Server: (Squeezebox Touch) Playing - 'Jaki Graham - Set Me Free'
2020-10-31 21:05:12.171 Logitech Media Server: (Squeezebox Touch) Playing - 'Calvin Harris & Sam Smith - Promises'
But these are logged by the switch and not by the script as far i can see
The script logs are in blue and devices are in white in the Domoticz log display
Re: Get data from swith to text in dummy switch
Posted: Saturday 31 October 2020 22:24
by waaren
madpatrick wrote: ↑Saturday 31 October 2020 21:11
It is a lot of information, but i'll just post it
2020-10-31 21:05:12.171 Logitech Media Server: (Squeezebox Touch) Playing - 'Calvin Harris & Sam Smith - Promises'
[/code]
Can you try this
Code: Select all
return
{
on =
{
devices =
{
430, -- ID of your LMS device
},
},
logging =
{
level = domoticz.LOG_DEBUG, -- set to domoticz.LOG_ERROR when all OK
marker = 'display songs',
},
execute = function(dz, item)
songDisplay = dz.devices('Song played') -- change to name of your virtual text sensor
songDisplay.updateText(item.rawData[1])
dz.log('Now playing' .. item.rawData[1] , dz.LOG_DEBUG)
end
}
Re: Get data from swith to text in dummy switch
Posted: Sunday 01 November 2020 9:38
by madpatrick
I'm added a dummy text switch which get the information from the script.
Only the output of the script is not a songtext
Code: Select all
2020-11-01 09:34:49.211 (Logitech Media Server) Lighting 2 (Squeezebox Touch)
2020-11-01 09:34:49.187 Status: User: Admin initiated a switch command (430/Squeezebox Touch/On)
2020-11-01 09:34:49.256 Status: dzVents: Info: Handling events for: "Squeezebox Touch", value: "On"
2020-11-01 09:34:49.256 Status: dzVents: Info: display songs: ------ Start internal script: LMS: Device: "Squeezebox Touch (Logitech Media Server)", Index: 430
2020-11-01 09:34:49.257 Status: dzVents: Debug: display songs: Processing device-adapter for LMS Songtext: Text device
2020-11-01 09:34:49.257 Status: dzVents: Debug: display songs: Now playing0
2020-11-01 09:34:49.257 Status: dzVents: Info: display songs: ------ Finished LMS
It is displaying "0"
Re: Get data from swith to text in dummy switch
Posted: Sunday 01 November 2020 11:45
by waaren
madpatrick wrote: ↑Sunday 01 November 2020 9:38
It is displaying "0"
Probably because the state was not 'Playing'
This might be a better one..
Code: Select all
return
{
on =
{
devices =
{
430, -- ID of your LMS device
},
},
logging =
{
level = domoticz.LOG_DEBUG, -- set to domoticz.LOG_ERROR when all OK
marker = 'display songs',
},
execute = function(dz, item)
songDisplay = dz.devices('Song played') -- change to name of your virtual text sensor
if item.state == 'Playing' then
songDisplay.updateText(item.rawData[1])
dz.log('Now playing: ' .. item.rawData[1] , dz.LOG_DEBUG)
else
songDisplay.updateText('Player state: '.. item.state)
dz.log('Player state: '.. item.state , dz.LOG_DEBUG)
end
end
}
Re: Get data from swith to text in dummy switch
Posted: Sunday 01 November 2020 11:50
by madpatrick
Still no luck.
Code: Select all
2020-11-01 11:47:38.589 (Logitech Media Server) Lighting 2 (Squeezebox Touch)
2020-11-01 11:47:38.621 Status: dzVents: Info: Handling events for: "Squeezebox Touch", value: "On"
2020-11-01 11:47:38.621 Status: dzVents: Info: display songs: ------ Start internal script: LMS: Device: "Squeezebox Touch (Logitech Media Server)", Index: 430
2020-11-01 11:47:38.622 Status: dzVents: Debug: display songs: Processing device-adapter for LMS Songtext: Text device
2020-11-01 11:47:38.622 Status: dzVents: Debug: display songs: Player state: On
2020-11-01 11:47:38.622 Status: dzVents: Info: display songs: ------ Finished LMS
2020-11-01 11:47:41.621 Logitech Media Server: (Squeezebox Touch) Playing - 'Mavericks - Dance The NIght Away'

Re: Get data from swith to text in dummy switch
Posted: Sunday 01 November 2020 11:58
by waaren
madpatrick wrote: ↑Sunday 01 November 2020 11:50
Still no luck.
Added some log statements to see what is happening.
Code: Select all
{
on =
{
devices =
{
430, -- ID of your LMS device
},
},
logging =
{
level = domoticz.LOG_DEBUG, -- set to domoticz.LOG_ERROR when all OK
marker = 'display songs',
},
execute = function(dz, item)
songDisplay = dz.devices('Song played') -- change to name of your virtual text sensor
dz.log(item.state,dz.LOG_DEBUG)
dz.log(item.rawData,dz.LOG_DEBUG)
dz.log(item.rawData[1],dz.LOG_DEBUG)
dz.log(item.sValues,dz.LOG_DEBUG)
dz.log(item.nValue,dz.LOG_DEBUG)
if item.state == 'Playing' then
songDisplay.updateText(item.rawData[1])
dz.log('Now playing: ' .. item.rawData[1] , dz.LOG_DEBUG)
else
songDisplay.updateText('Player state: '.. item.state)
dz.log('Player state: '.. item.state , dz.LOG_DEBUG)
end
end
}
Re: Get data from swith to text in dummy switch
Posted: Sunday 01 November 2020 12:07
by madpatrick
Output of the log
Code: Select all
2020-11-01 12:06:27.392 (Logitech Media Server) Lighting 2 (Squeezebox Touch)
2020-11-01 12:06:27.377 Status: User: Admin initiated a switch command (430/Squeezebox Touch/On)
2020-11-01 12:06:27.426 Status: dzVents: Info: Handling events for: "Squeezebox Touch", value: "On"
2020-11-01 12:06:27.426 Status: dzVents: Info: display songs: ------ Start internal script: LMS: Device: "Squeezebox Touch (Logitech Media Server)", Index: 430
2020-11-01 12:06:27.427 Status: dzVents: Debug: display songs: Processing device-adapter for Song played: Text device
2020-11-01 12:06:27.427 Status: dzVents: Debug: display songs: On
2020-11-01 12:06:27.427 Status: dzVents: Debug: display songs: {"0"}
2020-11-01 12:06:27.427 Status: dzVents: Debug: display songs: 0
2020-11-01 12:06:27.427 Status: dzVents: Debug: display songs: nil
2020-11-01 12:06:27.427 Status: dzVents: Debug: display songs: 1
2020-11-01 12:06:27.427 Status: dzVents: Debug: display songs: Player state: On
2020-11-01 12:06:27.427 Status: dzVents: Info: display songs: ------ Finished LMS
Re: Get data from swith to text in dummy switch
Posted: Sunday 01 November 2020 12:16
by waaren
madpatrick wrote: ↑Sunday 01 November 2020 12:07
Output of the log
Just let it run for some time while switching songs. The first time (the one with the item.dump() in it, the player had a different state and nValue and then it showed the song in rawData.
Re: Get data from swith to text in dummy switch
Posted: Sunday 01 November 2020 12:39
by madpatrick
Waaren,
I've switch some songs (radio station), but this doesn't trigger the script.
When i switch off/on the play, the script get triggered.
On the dummy switch, the text stays the same "Player state : On"
Code: Select all
2020-11-01 12:19:44.252 Logitech Media Server: (Squeezebox Touch) Playing - 'Marky Mark And The Funky Bunch - Good Vibration'
2020-11-01 12:21:24.365 Logitech Media Server: (Squeezebox Touch) Playing - 'RED HOT CHILI PEPPERS - UNDER THE BRIDGE'
2020-11-01 12:25:24.634 Logitech Media Server: (Squeezebox Touch) Playing - 'Radio 10 103.8 - René Verkerk'
2020-11-01 12:25:44.658 Logitech Media Server: (Squeezebox Touch) Playing - 'A Flock Of Seagulls - The More You Live, The More You Love'
2020-11-01 12:30:24.960 Logitech Media Server: (Squeezebox Touch) Playing - ' - NPO Radio 2 - Hofleverancier van de Liefde - BNNVARA '
2020-11-01 12:34:25.208 Logitech Media Server: (Squeezebox Touch) Playing - 'Britney Spears - Baby One More Time'
The log is not showing the script debug when i switch
I've swiched more then the logs is showing, but the update of the "Squeezebox Touch" switch updates with a delay longer then I switched
Re: Get data from swith to text in dummy switch
Posted: Sunday 01 November 2020 12:56
by waaren
madpatrick wrote: ↑Sunday 01 November 2020 12:39
I've switch some songs (radio station), but this doesn't trigger the script.
Then what did you do to produce the log with the dump() in it? At that time it showed the stated playing and the song in rawData as can be seen your posting of that log.
Re: Get data from swith to text in dummy switch
Posted: Sunday 01 November 2020 12:58
by madpatrick
I turned on the Squeezebox (switch 430)
After that is is not giving any log from the script
Re: Get data from swith to text in dummy switch
Posted: Sunday 01 November 2020 17:33
by waaren
madpatrick wrote: ↑Sunday 01 November 2020 12:58
I turned on the Squeezebox (switch 430)
After that is is not giving any log from the script
Let's see if we can get the song via another route. Please replace the script with this one and play a couple of songs and share the log
Code: Select all
local scriptVar = 'songDisplay'
return
{
on =
{
devices =
{
430, -- ID of your LMS device
},
httpResponses =
{
scriptVar,
}
},
logging =
{
level = domoticz.LOG_DEBUG, -- set to domoticz.LOG_ERROR when all OK
marker = scriptVar,
},
execute = function(dz, item)
songDisplay = dz.devices('Song played') -- change to name of your virtual text sensor
if item.isHTTPResponse and item.isJSON then
dz.utils.dumpTable(item.json)
else
dz.openURL(
{
url = dz.settings['Domoticz url'] .. '/json.htm?type=devices&rid=430',
callback = scriptVar,
})
end
end
}
Re: Get data from swith to text in dummy switch
Posted: Sunday 01 November 2020 17:55
by madpatrick
This is the log
Code: Select all
2020-11-01 17:51:27.601 Logitech Media Server: (Squeezebox Touch) On
2020-11-01 17:51:27.708 Status: dzVents: > Image: Light
2020-11-01 17:51:27.708 Status: dzVents: > Protected: false
2020-11-01 17:51:27.708 Status: dzVents: > UsedByCamera: false
2020-11-01 17:51:27.708 Status: dzVents: > Used: 1
2020-11-01 17:51:27.708 Status: dzVents: > TypeImg: LogitechMediaServer
2020-11-01 17:51:27.708 Status: dzVents: > Type: Lighting 2
2020-11-01 17:51:27.708 Status: dzVents: > SwitchType: Media Player
2020-11-01 17:51:27.708 Status: dzVents: > SubType: AC
2020-11-01 17:51:27.708 Status: dzVents: > StrParam1:
2020-11-01 17:51:27.708 Status: dzVents: > AddjMulti: 1.0
2020-11-01 17:51:27.708 Status: dzVents: > YOffset: 0
2020-11-01 17:51:27.708 Status: dzVents: > XOffset: 0
2020-11-01 17:51:27.708 Status: dzVents: > ShowNotifications: true
2020-11-01 17:51:27.708 Status: dzVents: > AddjValue2: 0.0
2020-11-01 17:51:27.708 Status: dzVents: > app_version: 2020.2
2020-11-01 17:51:27.708 Status: dzVents: > NautTwilightStart: 06:24
2020-11-01 17:51:27.708 Status: dzVents: > AstrTwilightEnd: 19:09
2020-11-01 17:51:27.708 Status: dzVents: > SunAtSouth: 12:27
2020-11-01 17:51:27.708 Status: dzVents: Info: songDisplay: ------ Finished LMS
2020-11-01 17:51:31.299 (Zwave USB) Light/Switch (PIR Sensor)
2020-11-01 17:51:31.303 (Zwave USB) General/Alarm (PIR Alarm Type: Home Security 7 (0x07))
2020-11-01 17:51:31.306 (Zwave USB) Light/Switch (PIR Home Security)
2020-11-01 17:51:31.386 (Zwave USB) General/Alarm (PIR Alarm Type: Home Security 7 (0x07))
2020-11-01 17:51:31.389 (Zwave USB) Light/Switch (PIR Home Security)
2020-11-01 17:51:31.435 (Zwave USB) Light/Switch (PIR Sensor)
2020-11-01 17:51:31.298 Status: OpenZWave: Alarm received (Home Security: Motion Detected at Unknown Location), NodeID: 31 (0x1f)
2020-11-01 17:51:31.329 Status: dzVents: Info: Handling events for: "PIR Sensor", value: "Off"
2020-11-01 17:51:31.386 Status: OpenZWave: Alarm received (Home Security: Motion Detected at Unknown Location), NodeID: 31 (0x1f)
2020-11-01 17:51:31.462 Status: dzVents: Info: Handling events for: "PIR Sensor", value: "On"
2020-11-01 17:51:47.625 Logitech Media Server: (Squeezebox Touch) Playing - 'Dire Straits - Money For Nothing'
2020-11-01 17:51:47.657 Status: dzVents: Info: Handling events for: "Squeezebox Touch", value: "Playing"
2020-11-01 17:51:47.657 Status: dzVents: Info: songDisplay: ------ Start internal script: LMS: Device: "Squeezebox Touch (Logitech Media Server)", Index: 430
2020-11-01 17:51:47.657 Status: dzVents: Debug: songDisplay: Processing device-adapter for Song played: Text device
2020-11-01 17:51:47.657 Status: dzVents: Debug: songDisplay: OpenURL: url = http://127.0.0.1:9200/json.htm?type=devices&rid=430
2020-11-01 17:51:47.657 Status: dzVents: Debug: songDisplay: OpenURL: method = GET
2020-11-01 17:51:47.658 Status: dzVents: Debug: songDisplay: OpenURL: post data = nil
2020-11-01 17:51:47.658 Status: dzVents: Debug: songDisplay: OpenURL: headers = nil
2020-11-01 17:51:47.658 Status: dzVents: Debug: songDisplay: OpenURL: callback = songDisplay
2020-11-01 17:51:47.658 Status: dzVents: Info: songDisplay: ------ Finished LMS
2020-11-01 17:51:47.695 Status: dzVents: Info: Handling httpResponse-events for: "songDisplay"
2020-11-01 17:51:47.696 Status: dzVents: Info: songDisplay: ------ Start internal script: LMS: HTTPResponse: "songDisplay"
2020-11-01 17:51:47.702 Status: dzVents: Debug: songDisplay: Processing device-adapter for Song played: Text device
2020-11-01 17:51:47.702 Status: dzVents: > NautTwilightStart: 06:24
2020-11-01 17:51:47.702 Status: dzVents: > DayLength: 09:36
2020-11-01 17:51:47.702 Status: dzVents: > SunAtSouth: 12:27
2020-11-01 17:51:47.702 Status: dzVents: > ServerTime: 2020-11-01 17:51:47
2020-11-01 17:51:47.702 Status: dzVents: > CivTwilightStart: 07:03
2020-11-01 17:51:47.702 Status: dzVents: > AstrTwilightEnd: 19:09
2020-11-01 17:51:47.702 Status: dzVents: > AstrTwilightStart: 05:45
2020-11-01 17:51:47.702 Status: dzVents: > CivTwilightEnd: 17:51
2020-11-01 17:51:47.702 Status: dzVents: > result:
2020-11-01 17:51:47.702 Status: dzVents: > 1:
2020-11-01 17:51:47.702 Status: dzVents: > AddjMulti2: 1.0
2020-11-01 17:51:47.702 Status: dzVents: > HaveGroupCmd: true
2020-11-01 17:51:47.702 Status: dzVents: > Protected: false
2020-11-01 17:51:47.702 Status: dzVents: > idx: 430
2020-11-01 17:51:47.702 Status: dzVents: > HaveDimmer: true
2020-11-01 17:51:47.702 Status: dzVents: > PlanID: 0
2020-11-01 17:51:47.702 Status: dzVents: > IsSubDevice: false
2020-11-01 17:51:47.702 Status: dzVents: > HardwareTypeVal: 60
2020-11-01 17:51:47.702 Status: dzVents: > Name: Squeezebox Touch
2020-11-01 17:51:47.702 Status: dzVents: > MaxDimLevel: 15
2020-11-01 17:51:47.702 Status: dzVents: > SubType: AC
2020-11-01 17:51:47.702 Status: dzVents: > HardwareID: 21
2020-11-01 17:51:47.702 Status: dzVents: > HaveTimeout: false
2020-11-01 17:51:47.702 Status: dzVents: > AddjMulti: 1.0
2020-11-01 17:51:47.702 Status: dzVents: > ID: 0000002
2020-11-01 17:51:47.702 Status: dzVents: > CustomImage: 0
2020-11-01 17:51:47.702 Status: dzVents: > HardwareName: Logitech Media Server
2020-11-01 17:51:47.702 Status: dzVents: > YOffset: 0
2020-11-01 17:51:47.702 Status: dzVents: > Level: 0
2020-11-01 17:51:47.702 Status: dzVents: > ShowNotifications: true
2020-11-01 17:51:47.702 Status: dzVents: > Timers: false
2020-11-01 17:51:47.702 Status: dzVents: > Description:
2020-11-01 17:51:47.702 Status: dzVents: > UsedByCamera: false
2020-11-01 17:51:47.702 Status: dzVents: > Used: 1
2020-11-01 17:51:47.702 Status: dzVents: > LevelInt: 0
2020-11-01 17:51:47.702 Status: dzVents: > Unit: 1
2020-11-01 17:51:47.702 Status: dzVents: > Data: Dire Straits - Money For Nothing
2020-11-01 17:51:47.702 Status: dzVents: > SignalLevel: -
2020-11-01 17:51:47.702 Status: dzVents: > Type: Lighting 2
2020-11-01 17:51:47.702 Status: dzVents: > Status: Playing
2020-11-01 17:51:47.702 Status: dzVents: > XOffset: 0
2020-11-01 17:51:47.702 Status: dzVents: > StrParam2:
2020-11-01 17:51:47.702 Status: dzVents: > AddjValue2: 0.0
2020-11-01 17:51:47.702 Status: dzVents: > SwitchType: Media Player
2020-11-01 17:51:47.702 Status: dzVents: > SwitchTypeVal: 17
2020-11-01 17:51:47.702 Status: dzVents: > PlanIDs:
2020-11-01 17:51:47.702 Status: dzVents: > 1: 0
2020-11-01 17:51:47.702 Status: dzVents: > StrParam1:
2020-11-01 17:51:47.702 Status: dzVents: > TypeImg: LogitechMediaServer
2020-11-01 17:51:47.702 Status: dzVents: > BatteryLevel: 255
2020-11-01 17:51:47.702 Status: dzVents: > Notifications: false
2020-11-01 17:51:47.702 Status: dzVents: > Favorite: 0
2020-11-01 17:51:47.702 Status: dzVents: > DimmerType: none
2020-11-01 17:51:47.702 Status: dzVents: > AddjValue: 0.0
2020-11-01 17:51:47.702 Status: dzVents: > HardwareType: Logitech Media Server
2020-11-01 17:51:47.702 Status: dzVents: > LastUpdate: 2020-11-01 17:51:47
2020-11-01 17:51:47.702 Status: dzVents: > Image: Light
2020-11-01 17:51:47.702 Status: dzVents: > app_version: 2020.2
2020-11-01 17:51:47.702 Status: dzVents: > NautTwilightEnd: 18:30
2020-11-01 17:51:47.703 Status: dzVents: > Sunrise: 07:39
2020-11-01 17:51:47.703 Status: dzVents: > ActTime: 1604249507
2020-11-01 17:51:47.703 Status: dzVents: > Sunset: 17:15
2020-11-01 17:51:47.703 Status: dzVents: > title: Devices
2020-11-01 17:51:47.703 Status: dzVents: > status: OK
2020-11-01 17:51:47.703 Status: dzVents: Info: songDisplay: ------ Finished LMS
2020-11-01 17:52:00.296 Status: dzVents: Info: ------ Start internal script: Toon_script:, trigger: "every minute"
2020-11-01 17:52:00.394 Status: dzVents: Info: ------ Finished Toon_script
2020-11-01 17:52:07.653 Logitech Media Server: (Squeezebox Touch) Playing - 'GOLDEN EARRING - INSTANT POETRY'
2020-11-01 17:52:11.101 (Zwave USB) Light/Switch (PIR Sensor)
2020-11-01 17:52:11.106 (Zwave USB) General/Alarm (PIR Alarm Type: Home Security 7 (0x07))
2020-11-01 17:52:11.110 (Zwave USB) Light/Switch (PIR Home Security)
2020-11-01 17:52:11.150 (Zwave USB) Light/Switch (PIR Sensor)
2020-11-01 17:52:11.100 Status: OpenZWave: Alarm received (Home Security: Clear), NodeID: 31 (0x1f)
2020-11-01 17:52:11.130 Status: dzVents: Info: Handling events for: "PIR Sensor", value: "Off"
2020-11-01 17:52:11.193 Status: dzVents: Info: Handling events for: "PIR Sensor", value: "Off"
2020-11-01 17:52:12.098 (Zwave USB) General/kWh (Buitenlamp - Voordeur [kWh])
2020-11-01 17:52:47.696 Logitech Media Server: (Squeezebox Touch) Playing - 'H.E.R. - Hold On'
2020-11-01 17:53:00.307 Status: dzVents: Info: ------ Start internal script: Toon_script:, trigger: "every minute"
2020-11-01 17:53:00.393 Status: dzVents: Info: ------ Finished Toon_script
2020-11-01 17:53:07.723 Logitech Media Server: (Squeezebox Touch) Playing - 'Break My Heart - DUA LIPA'
2020-11-01 17:53:27.741 Logitech Media Server: (Squeezebox Touch) Stopped - ' - Radio 538 102.7 (Top-40-Pop)'
2020-11-01 17:53:27.771 Status: dzVents: Info: Handling events for: "Squeezebox Touch", value: "Stopped"
2020-11-01 17:53:27.771 Status: dzVents: Info: songDisplay: ------ Start internal script: LMS: Device: "Squeezebox Touch (Logitech Media Server)", Index: 430
2020-11-01 17:53:27.771 Status: dzVents: Debug: songDisplay: Processing device-adapter for Song played: Text device
2020-11-01 17:53:27.771 Status: dzVents: Debug: songDisplay: OpenURL: url = http://127.0.0.1:9200/json.htm?type=devices&rid=430
2020-11-01 17:53:27.771 Status: dzVents: Debug: songDisplay: OpenURL: method = GET
2020-11-01 17:53:27.771 Status: dzVents: Debug: songDisplay: OpenURL: post data = nil
2020-11-01 17:53:27.771 Status: dzVents: Debug: songDisplay: OpenURL: headers = nil
2020-11-01 17:53:27.771 Status: dzVents: Debug: songDisplay: OpenURL: callback = songDisplay
2020-11-01 17:53:27.772 Status: dzVents: Info: songDisplay: ------ Finished LMS
2020-11-01 17:53:47.763 Logitech Media Server: (Squeezebox Touch) Playing - 'Radio 10 103.8 - Dennis Verheugd'
2020-11-01 17:53:47.795 Status: dzVents: Info: Handling events for: "Squeezebox Touch", value: "Playing"
2020-11-01 17:53:47.795 Status: dzVents: Info: songDisplay: ------ Start internal script: LMS: Device: "Squeezebox Touch (Logitech Media Server)", Index: 430
2020-11-01 17:53:47.796 Status: dzVents: Debug: songDisplay: Processing device-adapter for Song played: Text device
2020-11-01 17:53:47.796 Status: dzVents: Debug: songDisplay: OpenURL: url = http://127.0.0.1:9200/json.htm?type=devices&rid=430
2020-11-01 17:53:47.796 Status: dzVents: Debug: songDisplay: OpenURL: method = GET
2020-11-01 17:53:47.796 Status: dzVents: Debug: songDisplay: OpenURL: post data = nil
2020-11-01 17:53:47.796 Status: dzVents: Debug: songDisplay: OpenURL: headers = nil
2020-11-01 17:53:47.796 Status: dzVents: Debug: songDisplay: OpenURL: callback = songDisplay
2020-11-01 17:53:47.796 Status: dzVents: Info: songDisplay: ------ Finished LMS
2020-11-01 17:53:47.825 Status: dzVents: Info: Handling httpResponse-events for: "songDisplay"
2020-11-01 17:53:47.825 Status: dzVents: Info: songDisplay: ------ Start internal script: LMS: HTTPResponse: "songDisplay"
2020-11-01 17:53:47.830 Status: dzVents: Debug: songDisplay: Processing device-adapter for Song played: Text device
2020-11-01 17:53:47.830 Status: dzVents: > NautTwilightStart: 06:24
2020-11-01 17:53:47.830 Status: dzVents: > ActTime: 1604249627
2020-11-01 17:53:47.830 Status: dzVents: > title: Devices
2020-11-01 17:53:47.830 Status: dzVents: > status: OK
2020-11-01 17:53:47.830 Status: dzVents: > result:
2020-11-01 17:53:47.830 Status: dzVents: > 1:
2020-11-01 17:53:47.830 Status: dzVents: > Timers: false
2020-11-01 17:53:47.830 Status: dzVents: > YOffset: 0
2020-11-01 17:53:47.830 Status: dzVents: > Unit: 1
2020-11-01 17:53:47.830 Status: dzVents: > HaveTimeout: false
2020-11-01 17:53:47.830 Status: dzVents: > SwitchTypeVal: 17
2020-11-01 17:53:47.830 Status: dzVents: > Type: Lighting 2
2020-11-01 17:53:47.830 Status: dzVents: > Level: 0
2020-11-01 17:53:47.830 Status: dzVents: > Description:
2020-11-01 17:53:47.830 Status: dzVents: > Name: Squeezebox Touch
2020-11-01 17:53:47.830 Status: dzVents: > Favorite: 0
2020-11-01 17:53:47.830 Status: dzVents: > Used: 1
2020-11-01 17:53:47.830 Status: dzVents: > HardwareType: Logitech Media Server
2020-11-01 17:53:47.830 Status: dzVents: > StrParam2:
2020-11-01 17:53:47.830 Status: dzVents: > SubType: AC
2020-11-01 17:53:47.830 Status: dzVents: > idx: 430
2020-11-01 17:53:47.830 Status: dzVents: > IsSubDevice: false
2020-11-01 17:53:47.830 Status: dzVents: > LevelInt: 0
2020-11-01 17:53:47.830 Status: dzVents: > LastUpdate: 2020-11-01 17:53:47
2020-11-01 17:53:47.830 Status: dzVents: > AddjMulti2: 1.0
2020-11-01 17:53:47.830 Status: dzVents: > XOffset: 0
2020-11-01 17:53:47.830 Status: dzVents: > PlanIDs:
2020-11-01 17:53:47.830 Status: dzVents: > 1: 0
2020-11-01 17:53:47.830 Status: dzVents: > MaxDimLevel: 15
2020-11-01 17:53:47.830 Status: dzVents: > HardwareID: 21
2020-11-01 17:53:47.830 Status: dzVents: > TypeImg: LogitechMediaServer
2020-11-01 17:53:47.830 Status: dzVents: > SwitchType: Media Player
2020-11-01 17:53:47.830 Status: dzVents: > HardwareName: Logitech Media Server
2020-11-01 17:53:47.830 Status: dzVents: > StrParam1:
2020-11-01 17:53:47.830 Status: dzVents: > Status: Playing
2020-11-01 17:53:47.830 Status: dzVents: > Image: Light
2020-11-01 17:53:47.830 Status: dzVents: > DimmerType: none
2020-11-01 17:53:47.830 Status: dzVents: > UsedByCamera: false
2020-11-01 17:53:47.830 Status: dzVents: > Data: Radio 10 103.8 - Dennis Verheugd
2020-11-01 17:53:47.830 Status: dzVents: > HaveDimmer: true
2020-11-01 17:53:47.830 Status: dzVents: > AddjValue: 0.0
2020-11-01 17:53:47.830 Status: dzVents: > ShowNotifications: true
2020-11-01 17:53:47.830 Status: dzVents: > Notifications: false
2020-11-01 17:53:47.830 Status: dzVents: > AddjValue2: 0.0
2020-11-01 17:53:47.830 Status: dzVents: > ID: 0000002
2020-11-01 17:53:47.830 Status: dzVents: > HardwareTypeVal: 60
2020-11-01 17:53:47.830 Status: dzVents: > Protected: false
2020-11-01 17:53:47.830 Status: dzVents: > BatteryLevel: 255
2020-11-01 17:53:47.830 Status: dzVents: > SignalLevel: -
2020-11-01 17:53:47.830 Status: dzVents: > CustomImage: 0
2020-11-01 17:53:47.830 Status: dzVents: > HaveGroupCmd: true
2020-11-01 17:53:47.830 Status: dzVents: > PlanID: 0
2020-11-01 17:53:47.830 Status: dzVents: > AddjMulti: 1.0
2020-11-01 17:53:47.830 Status: dzVents: > app_version: 2020.2
2020-11-01 17:53:47.830 Status: dzVents: > Sunrise: 07:39
2020-11-01 17:53:47.830 Status: dzVents: > Sunset: 17:15
2020-11-01 17:53:47.830 Status: dzVents: > AstrTwilightEnd: 19:09
2020-11-01 17:53:47.830 Status: dzVents: > SunAtSouth: 12:27
2020-11-01 17:53:47.830 Status: dzVents: > DayLength: 09:36
2020-11-01 17:53:47.830 Status: dzVents: > NautTwilightEnd: 18:30
2020-11-01 17:53:47.830 Status: dzVents: > AstrTwilightStart: 05:45
2020-11-01 17:53:47.830 Status: dzVents: > ServerTime: 2020-11-01 17:53:47
2020-11-01 17:53:47.831 Status: dzVents: > CivTwilightStart: 07:03
2020-11-01 17:53:47.831 Status: dzVents: > CivTwilightEnd: 17:51
2020-11-01 17:53:47.831 Status: dzVents: Info: songDisplay: ------ Finished LMS
2020-11-01 17:54:00.317 Status: dzVents: Info: ------ Start internal script: Toon_script:, trigger: "every minute"
2020-11-01 17:54:00.401 Status: dzVents: Info: ------ Finished Toon_script
2020-11-01 17:54:07.784 Logitech Media Server: (Squeezebox Touch) Playing - 'Michael Bublé - Everything'
The switch now says : "Player state : off" when the player is On
Re: Get data from swith to text in dummy switch
Posted: Sunday 01 November 2020 18:26
by waaren
madpatrick wrote: ↑Sunday 01 November 2020 17:55
The switch now says : "Player state : off" when the player is On
Maybe this will do it. If not; I am out of options
Code: Select all
local scriptVar = 'songDisplay'
return
{
on =
{
devices =
{
430, -- ID of your LMS device
},
httpResponses =
{
scriptVar,
}
},
logging =
{
level = domoticz.LOG_DEBUG, -- set to domoticz.LOG_ERROR when all OK
marker = scriptVar,
},
execute = function(dz, item)
songDisplay = dz.devices('Song played') -- change to name of your virtual text sensor
if item.isHTTPResponse and item.isJSON then
songDisplay.updateText(item.json.result[1].Data)
dz.log('Now playing: ' .. item.json.result[1].Data , dz.LOG_DEBUG)
else
dz.openURL(
{
url = dz.settings['Domoticz url'] .. '/json.htm?type=devices&rid=430',
callback = scriptVar,
})
end
end
}