Welcome to Smart Home Forum by FIBARO
Dear Guest,
as you can notice parts of Smart Home Forum by FIBARO is not available for you. You have to register in order to view all content and post in our community. Don't worry! Registration is a simple free process that requires minimal information for you to sign up. Become a part of of Smart Home Forum by FIBARO by creating an account.
As a member you can:
- Start new topics and reply to others
- Follow topics and users to get email updates
- Get your own profile page and make new friends
- Send personal messages
- ... and learn a lot about our system!
Regards,
Smart Home Forum by FIBARO Team

Question
mortesan 9
I am setting up some controls for my chromecast audios with a webserver on a raspberry Pi, I am fetching the values like volume and whats playing, but when there's nothing playing on the chromecast I get a nil value and the scene stops, how can I handle these nil values?
could I use something like if ~ = nil ?
local http = net. HTTPClient ()
http : request ( "http://xxx/getDeviceStatus?address=xxx", {
options = {
method = "PUT",
},
success = function(status)
response = status.data
svar = json.decode(response)
--printer verdier
print ("Volum: "..svar.status.volume.level);
print ("Muted: "..tostring(svar.status.volume.muted));
print ("Spiller fra: "..tostring(svar.status.applications[1].displayName));
print ("Media: "..tostring(svar.status.applications[1].statusText));
print ("sessioId: "..tostring(svar.status.applications[1].sessionId));
fibaro:setGlobal('volumbad',svar.status.volume.level);
fibaro:setGlobal('spillerbad',tostring(svar.status.applications[1].displayName));
fibaro:setGlobal('idbad',svar.status.applications[1].sessionId);
end
})
Debug:
Please login or register to see this attachment.
Please login or register to see this attachment.
4 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.