Page 1 of 1

Blocky Virtual Text input

Posted: Monday 16 October 2017 15:44
by pro2call
Hello,

Im running a script wich read's out my yamaha reciever. it update's the switch perfectly. Only when i want to read the status in blocky to make events. ist not doing anything. please help.

Re: Blocky Virtual Text input

Posted: Tuesday 24 October 2017 13:17
by Slinkos
That's because "Radio" is not the state of your switch. It's more something like a property. It's hard for me to give a solution for this right away, but maybe you can get some more info if you look at the properties using /json.htm?type=devices&rid=IDX

Maybe you can add a json command to your script that also updates the state of the switch itself to "Radio"

Re: Blocky Virtual Text input

Posted: Wednesday 25 October 2017 19:00
by pro2call
Hello slinkos,

Any idea how to get the data into some useful position?

Code: Select all

{
   "ActTime" : 1508950630,
   "ServerTime" : "2017-10-25 18:57:10",
   "Sunrise" : "08:21",
   "Sunset" : "18:19",
   "result" : [
      {
         "AddjMulti" : 1.0,
         "AddjMulti2" : 1.0,
         "AddjValue" : 0.0,
         "AddjValue2" : 0.0,
         "BatteryLevel" : 255,
         "CustomImage" : 0,
         "Data" : "HDMI1",
         "Description" : "",
         "Favorite" : 1,
         "HardwareID" : 8,
         "HardwareName" : "Virtual switch ",
         "HardwareType" : "Dummy (Does nothing, use for virtual switches only)",
         "HardwareTypeVal" : 15,
         "HaveTimeout" : false,
         "ID" : "00082124",
         "LastUpdate" : "2017-10-25 18:57:06",
         "Name" : "Versterker input",
         "Notifications" : "false",
         "PlanID" : "0",
         "PlanIDs" : [ 0 ],
         "Protected" : false,
         "ShowNotifications" : false,
         "SignalLevel" : "-",
         "SubType" : "Text",
         "Timers" : "false",
         "Type" : "General",
         "TypeImg" : "text",
         "Unit" : 1,
         "Used" : 1,
         "XOffset" : "0",
         "YOffset" : "0",
         "idx" : "124"
      }
   ],
   "status" : "OK",
   "title" : "Devices"
}

Re: Blocky Virtual Text input

Posted: Thursday 26 October 2017 1:24
by Slinkos
Actually I did not look at it good enough. It's not a switch but text utilty as you say in your subject. Maybe we can think of another way to achieve what you want? Do you really need this kind of switch? Maybe you can fill a variable, or use a selector switch or whatever. It all depends on your goal.

Re: Blocky Virtual Text input

Posted: Thursday 26 October 2017 1:56
by Slinkos
So i did some testing myself with virtual text sensor. Blocky doesn't seem to be triggered by a new svalue, but it can be achieved in LUA. Use the following script:

Code: Select all

commandArray = {}

if (devicechanged['Versterker input']) then
	if (otherdevices_svalues['Versterker input'] == 'Radio') then
	    commandArray['Dummy']='On'
	    print ("Versterker input");
	end
end

return commandArray
I added a print as you did a Write-Log in your blocky. I also did added a command that switches a Dummy switch to 'On'. That's because I don't know what your goal is in the end. If you need any more help with that let me know.