Jump to content

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


Search the Community

Showing results for tags 'vd'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • FIBARO Community
    • FIBARO Portal and Forum policy
    • FIBARO
    • Say hello!
    • Off-topics
  • FIBARO Update
    • FIBARO System Update
    • FIBARO Mobile Update
  • FIBARO Community Support
    • Scenes and Interface
    • FIBARO Products
    • FIBARO Mobile
    • FIBARO HomeKit
    • FIBARO Assistant Integrations
    • Other Devices / Third-party devices
    • Tutorials and Guides
    • Home Automation
    • Suggestions
  • FIBARO Społeczność
    • FIBARO
    • Przywitaj się!
    • Off-topic
  • FIBARO Aktualizacja
    • FIBARO System Aktualizacja
    • FIBARO Mobile Aktualizacja
  • FIBARO Wsparcie Społeczności
    • Sceny i Interfejs
    • FIBARO Urządzenia
    • FIBARO Mobilnie
    • FIBARO HomeKit
    • Integracja z Amazon Alexa i Google Home
    • Urządzenia Firm Trzecich
    • Poradniki
    • Automatyka Domowa
    • Sugestie

Categories

  • Scenes
  • Virtual Devices
  • Quick Apps
  • Icons

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Facebook


Google+


Skype


Website URL


WhatsApp


Country


Gateway/s


Interests

  1. Hi, Enyone who can help me turn my Sony reciever str-DN1050 ON/OFF trough HC2 ? Nothing fancy, just an VD for ON/OFF and maybe input source an volume... Is this possible? Cant find anything....
  2. ZXT-120 is an IR extender for air conditioners, but it can be learned up to 20 defferent ir code for multimedia. The process of learning of zxt-120 is written in its manual, but i want to show a way to use that codes in fibaro HC. For this purpose we have to make a virtual device, and fill its IP Address with your HC ip, and write 80 in TCP port box: Then make buttons according to your multimedia device: Now you have to write commands for corresponding buttons. For example for first button: We can learn up to 20 code according to this list: Use this command for changing mode : /api/callAction?deviceID=107&name=setMode&arg1=0 For setting temperature (in cooling mode): /api/callAction?deviceID=107&name=setThermostatSetpoint&arg1=2&arg2=23 For setting temperature (in heating mode): /api/callAction?deviceID=107&name=setThermostatSetpoint&arg1=1&arg2=21
  3. I got a VD that collects lux for me and put it as global variable, yesterday i received something wrong in the readout as you could see below. The VD collects data thru json , all code is in mainloop. When this unexpected answer from the device shows up, the VD stop working, the only way to get it up and running again is to reboot the HC:2, is there any other way to get the VD to start again? [DEBUG] 18:03:49: 0.83 [DEBUG] 18:04:49: 0.83 [DEBUG] 18:05:52: 0.83 [ERROR] 18:07:56: line 7: Expected value but found T_END at character 1 Code in mainloop selfId = fibaro:getSelfId() sleeptimer = 1 -- minutes between pollning local WEB = Net.FHttp("192.168.88.65",80) -- IP to your espeasy local response ,status, err = WEB:GET("/json?tasknr=1") -- task id on espeasy if (tonumber(status) == 200 and tonumber(err)==0) then local jsonTable = json.decode(response) name = jsonTable.TaskName value = jsonTable.Lux fibaro:debug(value) --fibaro:log(value) fibaro:call(selfId, "setProperty", "ui.Label1.value", value.." Lux") fibaro:setGlobal("Sun", value) end fibaro:sleep(sleeptimer*1000*57)
  4. I want to try to operate my AC using the AC Panel... Shouldn't be hard right? The problem is that I'm using the Remotec to control the AC. In linked devices, it wont let me select anything but switches. My thought was to make a VD to control the AC unit. But no VD comes up in linked devices.... How does anyone control the AC using the AC Panel? This seems like a joke.
  5. How to make a button in a VD what will restart your HC2 ? Thanks for your help -sbo
  6. Hi HC2 guru's Would a scene with a xxx value in the header/properties or a VD main loop be more efficient (ie use less resources) if I wanted to use a sensor (motion, light, humidity) to trigger an action. I find some of my sensors don't always react to a scene header trigger and in a vd. I think I could also exert a better level of control with repeat triggers with a vd but I wanted to make sure that this approach wouldn't impact the HC2 excessively Thanks -f
  7. Hello, I need your help guys;) I want to display the data from YT in vd: the amount of views on a particular channel and the total number of videos I have a direct link that displays information in JSON: https://www.googleapis.com/youtube/v3/channels?part=statistics&id={CHANNEL_ID}&key={YOUR_API_KEY} If I put it in web browser, I see the following information: // 20170117085953 // https://www.googleapis.com/youtube/v3/channels?part=statistics&id={CHANNEL_ID}&key={MY_API_KEY} { "kind": "youtube#channelListResponse", "etag": "\"gMxXHe-zin558lTnzKu8vjcmDI/2Qud556x4kgLe-969qH7-65gh7t\"", "pageInfo": { "totalResults": 1, "resultsPerPage": 1 }, "items": [ { "kind": "youtube#channel", "etag": "\"gMxXHe-zinKdE9TTEzKu8vjcmDI/q3O415qUconyEsljnEa554j5mM\"", "id": "{CHANNEL_ID}", "statistics": { "viewCount": "34315", "commentCount": "0", "subscriberCount": "76", "hiddenSubscriberCount": false, "videoCount": "74" } } ] } I want to import from the above data to VD following information: viewCount": videoCount": I know that the connection to the data is encrypted (via https), so I created a php script and put it on my server: <?php $url = fopen( ‚https://www.googleapis.com/youtube/v3/channels?part=statistics&id={CHANNEL_ID}&key={MY_API_KEY}’, ‚r’ ); $wynik = ”; while (!feof($url)) { $wynik .= fread($url, 8192); } fclose( $url ); header(‚Content-Type: application/json’); print_r($wynik); ?> Then I created of virtual device on the Home Center: HC2 = Net.FHttp(„ADDRESS_OF_MY_HOSTING”,80); dane ,status, errorCode = HC2:GET(„/PHPFILE.php”); ajson=json.decode(dane) view=ajson.items[1].statistics.viewCount fibaro:call(195,’setProperty’,’ui.Label1.value’,tostring(view)) video=ajson.items[1].statistics.videoCount fibaro:call(195,’setProperty’,’ui.Label2.value’,tostring(video)) The problem is that it does not collect any data from YouTube. In main look I see: line 2: unexpected symbol near '�' If anyone has any idea where I made a mistake or how I can accomplish in a different way?
  8. Hi When I try to import a vfib file I get this error "403" access forbidden. Any clues ?
  9. Hello, I've recently moved to the ZWave world when I bought a HC2 and some devices. But I still have some i Nexa and Telldus switch devices I can use outside and have not found any suitable ZWave ones. Therefore the idea to control the Nexa/Telldus devices using HTTP requests to the API of Telldus Live. Just simple things like turn on and turn off the switches. The IDs of the switches I thought I could input into the LUA code of each Virtual Device to keep it simple. What I don't seem to find any good information about is the whole Oauth thing with authorization requests, access tokens and stuff until I can finally to the request regarding the switches. Has anybody any clues or hopefully already has done this successfully? I found some documentation on the APIs at Telldus: http://api.telldus.com/documentation/phpLive (only PHP examples I don't really understand, strange language PHP) and then some more 3rd party doc at https://market.mashape.com/warting/telldus Need help/directions both on how to do the http-requests in LUA and the more Telldus API specifics. Once I understand those important things I'm sure I can get rest of the VD to work, it should be little more than on/off buttons and maybe some status message... We'll see once I get there. Look forward to some input and/or experience in the matter... Kind regards Bjorn
  10. I would like to create a scenne called "sleep time" which is invoked by amazon's Alexa by saying "Alexa turn on sleep time". The purpose is to turn bedroom lights off and switch off my Kld-40hx750 Sony Tv by sending the http post protocol (text/xml) to the TV like in attached Foto (the one is working example where I switch my tv to netflix by saying "Alexa, turn on Netflix" (to turn tv off the code is the same with the only difference in the string "AAAA..."). The Problem I have is that I can not send to Fibaro the Get Method (text/html) to turn the lights off (second Foto) and in the same time http post (text/xml) using HA Bridge (perhaps I'm wrong?). Therfore I was thinking to run the scene in Fibaro to turn the lights off simple calling function "fibaro:call(ID, "turnOff")" but the Problem remain with sending the http post protocol to the TV. I have read this can be done by making VD and sending http Protocol over it. Any help would be appreciated.
  11. Hi, I am converting and combining some of my scenes into Virtual devices I noticed that the main loop code seems to 'loop' every 3 seconds. I thought it was every one second here is the code and the debug screen function UpdateEventLog(eventStr) local currDate = (os.date("%b %d - %H:%M")) local updStr = (fibaro:getGlobal("Log_Event") .."".. currDate .." ".. eventStr .." \n") fibaro:setGlobal("Log_Event", updStr) end -- Auto lights Hotpress local HotPressLightID = 143 local HotPressDoorSensorID = 888 if (tonumber(fibaro:getValue(HotPressDoorSensorID, "value"))) == 1 then fibaro:call(HotPressLightID, "turnOn") UpdateEventLog("Hotpress auto-light activated") else fibaro:call(HotPressLightID, "turnOff") end -- Auto lights Dining Room local DiningCenterLightID = 25 fibaro:debug(tonumber(fibaro:getValue(DiningCenterLightID, "value"))) if ((fibaro:getGlobalValue("G_SPC_ZONE_INPUT_19") == "OPEN") and (fibaro:getGlobalValue("TODModeInside") == "night") and (tonumber(fibaro:getValue(DiningCenterLightID, "value"))) == 0) then fibaro:call(DiningCenterLightID, "setValue", "30") UpdateEventLog("Dining Room auto-lights activated") end Thanks Frank
  12. HI, Looking for some advice here I have a simple scenario. Enter room, sensor picks up the movement, lamp turns on. I can implement this as a scene (clode below) but I seem to get a lot of "too many instances", presumable because the sensor gets triggered when we are in the room I could also implement this as a VD in the main loop (code below) In terms of best practice or least load on the HC2 or what do our guru's generally do ? Thanks Frank VD Lua -- Configuration Device ID's local LivingRoomLamp = 1423 local LivingRoomLight = 231 if (fibaro:getGlobalValue("G_SPC_ZONE_INPUT_18") == "OPEN") and (fibaro:getGlobalValue("TODModeInside") == "night") and (fibaro:getValue(LivingRoomLight, "value") == "0") then fibaro:debug("turning on living room lamp") fibaro:call(LivingRoomLamp, "turnOn") end fibaro:sleep(3000) Scene Lua --[[ %% properties %% events %% globals G_SPC_ZONE_INPUT_18 --]] -- Configuration - Scene Info sceneName = "Autolights On for living room" sceneVersion = "1.0.1" -- Configuration Device ID's local LivingRoomLamp = 1423 local LivingRoomLight = 231 -- Validate Number of Scene Instance if (fibaro:countScenes()>1) then fibaro:debug("stop scene, to many instances") fibaro:abort() end function UpdateEventLog(eventStr) local currDate = (os.date("%b %d - %H:%M")) local updStr = (fibaro:getGlobal("Log_Event") .."".. currDate .." ".. eventStr .." \n") fibaro:setGlobal("Log_Event", updStr) end -- Main Scene Execution Code function tempFuncLiving() if (fibaro:getGlobalValue("G_SPC_ZONE_INPUT_18") == "OPEN") and (fibaro:getGlobalValue("TODModeInside") == "night") and (fibaro:getValue(LivingRoomLight, "value") == "0") then fibaro:debug("turning on living room lamp") fibaro:call(LivingRoomLamp, "turnOn") UpdateEventLog("living room auto lamp on") end fibaro:sleep(3000) end tempFuncLiving()
  13. HCL version 4.100 (stable). I noticed that in case you change the order of labels in a VD that scene's, writing info in those labels, use the wrong one. Reproduce it : Create a VD with 2 labels. Write a scene in which you write information to a label of the VD. Create 2 different scene's within each 1 of the different VD labels in it. Test your scene's. Re-order the labels in the VD. Open the scenes. You'll see now it's using the wrong label. Change to the correct label in your scene. Close the scene. Open the scene again --> if you're fast, you'll even see now that is has the old (wrong) label even still in memory. After a second, you'll see the correct label. After the change, it's correctly working. But if you want to reorganize your VD, it can be a lot of work to change your scene's.
  14. In the app we have the room "lamps" How to assign a VD as being a lamp, so that the VD will be displayed in the lamp room in the app? if not that would be a great feature.
  15. Is it possible to add feature that when VD main icon is changed that are also changed icons of all buttons on that VD with the same icon at the same time? It is really tiresome to change icons on all buttons one by one, especially if VD has plenty of them like the ones that are remote controls? It would be really nice to have this feature. Pleeeease Fibaro in some of the next releases.
  16. Hello, Is there someone who can help to make a VD in Fibaro HC2, that makes it possible to hear Spotify on SONOS. So that when I return home, automatically my favorite playlist in Spotify on my SONOS system can be heard? Who dares? Greetz John
  17. Hi, Looking for some help with some VD code for a Global cache GC-100-12 as I can seem to get anything to work My TV is connected to IR Port 3 on the gc device i used the GCIRE learner for the power button on the remote This is the string I got sendir,1:1,0,40000,1,1, 96,23,48,23,24,23,48,23,24,23,48,23,24,23,24,23,48,23,24,23,24,23,24,23,24,1029, 96,23,48,23,24,23,48,23,24,23,48,23,24,23,24,23,48,23,24,23,24,23,24,23,24,1029, 96,23,48,23,24,23,48,23,24,23,48,23,24,23,24,23,48,23,24,23,24,23,24,23,24,1029, 96,23,48,23,24,23,48,23,24,23,48,23,24,23,24,23,48,23,24,23,24,23,24,23,24,1029, 96,23,48,23,24,23,48,23,24,23,48,23,24,23,24,23,48,23,24,23,24,23,24,23,24,4018 in the iLearn app the first two lines are colored - not sure what this means but I took the whole string..... I changed the second number after the sendir from sendir,1:1 to sendir,1:3 as I am using port 3 on the GC unit (I also changed this to 1, 2, 3, 4, 5, 6 and none of them work) I created a VD with the following I included both 0x0D and 0x0D0x0A at the end of the sent string and neither worked I also tried some lua code in a VD with the /r at the end and no luck with that either fibaro:log("Connecting..."); fibaro:debug("Connecting..."); local selfId = fibaro:getSelfId(); local ip = "192.168.1.111"; local port = 4998; tcpSocket = Net.FTcpSocket(ip, port); tcpSocket:setReadTimeout(1000); -- POWER -- tcpSocket:write("sendir,1:3,0,40000,1,1, 96,23,48,23,24,23,48,23,24,23,48,23,24,23,24,23,48,23,24,23,24,23,24,23,24,1029, 96,23,48,23,24,23,48,23,24,23,48,23,24,23,24,23,48,23,24,23,24,23,24,23,24,1029, 96,23,48,23,24,23,48,23,24,23,48,23,24,23,24,23,48,23,24,23,24,23,24,23,24,1029, 96,23,48,23,24,23,48,23,24,23,48,23,24,23,24,23,48,23,24,23,24,23,24,23,24,1029, 96,23,48,23,24,23,48,23,24,23,48,23,24,23,24,23,48,23,24,23,24,23,24,23,24,4018\r"); fibaro:sleep(2000); result, err = tcpSocket:read(); tcpSocket:write("END"); if (err == 0) then fibaro:log("transfer OK"); fibaro:debug("transfer OK"); fibaro:log("Please Wait..."); fibaro:sleep(5000); else fibaro:log("transfer failed"); fibaro:debug("transfer failed"); end tcpSocket:disconnect(); finally i tried a reboot in case I had too many socket connections open but that didnt make any difference Would somebody that has this working have a look and perhaps let me know where I have gone wrong Thanks -frustrated
  18. Hello, I do not know if somebody posted it here. Fibaro, can you add label from virtual device to a condition into block scenes? It could save us many trouble with compare some desired values with label in VDs. I know, i can make it into Global variables, but they are unreliable (mine opinion only), because i think parameter "invokeScenes" is set to false by default. Many times happened to me that scene did not run, even if Global variable had desired value.
  19. Morning all! Been trying to figure all the documentation all last night about Global Variables and the API. I can look at the status of a variable but no idea how to set it using the API? Does anyone know the line for setting Global Variables using the API? Thanks!!
  20. Implement Sonos VD using node-http-API running on raspberry PI The following should help if you want to implement an sonos VD that leverages the node sonos http api by jishi The post consists in two parts Setting up the API on a raspberry pi Creating the VD and summary of other uses of the API and some sample code I use **I'll structure this in a better format in the coming weeks but for now it should be sufficient** I have tested this with Play1, 3, 5 (older version) ZP100, ZP80, ZP90. I don’t have a sonos soundbar or sub but from reading other forums it should work fine for those I intend to use this more in ‘Press Button’ mode rather than directly as a remote control but it should be good either way. You can also select what appears in HC2 UI by clicking the ‘main’ checkbox on the appropriate VD button ( I think you can have one button, one label and one slider) Credit & Reuse: This work draws on the work of many many people from both this forum as well as other forums. Without these people and the work they have done as well as what they have helped me learn over the last 12 months this wouldn't have been created. Like all VD’s please feel free to constructively criticise or modify it to meet your needs STEP1: Setup api on node.js device: This VD requires jishi’s node-sonos-http-api to be installed on a node.js capable device. This can be a RPi, a NAS or something similar. Details on where to get the code and install can be found on Git - https://github.com/jishi/node-sonos-http-api You will also find an excellent blog/issue tracker at the link above for any issues you encounter I have mine installed on a Rpi Added Feb 5th The fastest way I found to get up and running on a PI if you're unsure and just want to try it (takes about 15 minutes) Use the sonos-api precompiled rpi image at http://jishi.github.io/node-sonos-http-api/ (apply to blank sd card) when you login over SSH (with something like putty) the password is root Map a network drive or Start Run to \\<IP of Pi>\flash click apps folder and you'll see the sonos-http-api folder Get an API from VoiceRSS and create a settings.json file (details in the post) and drop it into the sonos-http-api folder reboot and that's it - test through browser with something like http://<ip-of-Pi:5005/<playername>/Say/Hello If you want to upgrade to the latest api release Download the latest zip from https://github.com/jishi/node-sonos-http-api (green button on right) In the flash folder rename the sonos-http-api to -old Rename what you downloaded to to sonos-http-api Drop in your settings.json file SSH into the Pi - login = root cd /flash/apps cd sonos-http-api npm install --production when finished reboot DOCKER from @riemers (thanks ) You could also use docker Some nas systems include docker too (synology) from the gui. Using docker is easy and simple to give to someone else too, work on Pi3 too. For node-sonos-api there is a docker image https://github.com/chrisns/docker-node-sonos-http-api saves you the hassle of installing all dependency's, assuming you have some knowledge with linux. # Edit - additional observation - I like the Synology NAS option but mine doesn't reboot in the event of a power outage. The Rpi does reboot. If you use a NAS it might be good to use a UPS or find a way to reboot after an outage Once you have this setup you are ready to move on to Step 2 STEP 2 : Import the VD, you will need one VD per sonos zone node-sonos-api VD.vfib Name - The zone name needs to be the same as what it is in native Sonos (try and avoid chars such as /,etc) Spaces are okay IP Address: This is the IP of the device where the api is installed (This is NOT the IP address of the sonos zone) Port: Leave at 5005 (can be changed it needed, see git above) STEP 3 : Configure Play, Stop, Repeat, Shuffle, etc – this should work as is The parts you may want to modify are as follows => Volume I opted for the vol + / vol – as opposed to the slider as I find the sliders difficult to use on a tablet Vol + / - operates in increments of 2%. This is easy to change in the url string. The Vol 10% button is also easy to change => Favourites You will need to modify this to your favourites and how they are named in your sonos setup I would advise simplifying these names in the native Sonos setup as much as you can. Spaces are okay, you just need to use %20 where you have a space in a name If you need more of less favourites, please add/delete buttons as required => Playlists I don’t really use them but these are easily enough added in a similar way to the favourites above. => Line-in selection You can create one button for each line in option on your setup for any connect/connect amp or Zp unit.. (I have 4 on my setup) You will need to get the UUID for the zone that has the line in physically connected to it. You can get the UUID of that zone by viewing the topology of the zone with the topology url. (drop it into chrome/ff) http://[IP of any of your zone]:1400/status/topology The format of the url http://192.168.1.89:5005/kitchen/setavtransporturi/x-rincon-stream:RINCON_000E5832B85401400 and you will need to change the last numerical string for your own UUID. => Grouping Zones I have included two examples of grouping and ungrouping The url format is simple and easy to read. below are two examples that were setup on the kitchen zone where I wanted to group the Playroom zone two it and play what was playing on the kitchen zone Group - [playroom joining kitchen and playing kitchen music] http://192.168.1.89:5005/playroom/join/kitchen Ungroup - [playroom leaving kitchen zone] http://192.168.1.89:5005/playroom/ungroup/kitchen You could also include a group all and an ungroup all by stacking the commands from each zone under one button. There are also options to control volume of grouped zones if you like but I haven't explored that yet Beyond this… The api is very extensive and still undergoing development. There are other functions in the api that could be used and might be worth a glance depending on your system and patterns of use I'll update the post this evening with the actual VD as I can't seem to export it remotely. The node.js api will need to be installed first before the VD will be of any use. Hopefully it will be of use to some people Thanks -Frank Update: Adding VD file Adding some extra information The api is very extensive and seems to keep growing I use it for mainly behind the scenes control rather than me clicking the vd/scenes buttons manually If you look at http://zone_ip:5005/room_name/state for any of your players you’ll see all the state json info and what’s possible to control/trigger from Pretifying the json will show it's structure better { "currentTrack": { "title": "x-sonosapi-stream:s2846?sid=254&flags=32", "albumArtUri": "\/getaa?s=1&u=x-sonosapi-stream%3as2846%3fsid%3d254%26flags%3d32", "duration": 0, "uri": "x-sonosapi-stream:s2846?sid=254&flags=32", "type": "radio", "absoluteAlbumArtUri": "http:\/\/192.168.1.63:1400\/getaa?s=1&u=x-sonosapi-stream%3as2846%3fsid%3d254%26flags%3d32" }, "nextTrack": { "artist": "", "title": "", "album": "", "albumArtUri": "", "duration": 0, "uri": "" }, "volume": 10, "mute": false, "trackNo": 1, "elapsedTime": 651, "elapsedTimeFormatted": "00:10:51", "playbackState": "PLAYING", "playMode": { "repeat": "none", "shuffle": false, "crossfade": false } } I have a VD that shows me the status of all my players (attached) main scene code (just add labels local device = fibaro:getSelfId(); local zonename = fibaro:getName(device); local ipaddress = fibaro:getValue(device, "IPAddress"); local port = fibaro:getValue(device, "TCPPort"); sonos = Net.FHttp(ipaddress, port); local jS = json.decode(fibaro:getGlobalValue("StateTable")) -- zero the counter for each loop local zoneCount = 0 -- LANDING response = sonos:GET("/Landing/state") jsonTable = json.decode(response); if jsonTable.playbackState == "PLAYING" then zoneCount = zoneCount + 1 jS.Landing_Stairs.isPlaying = 1 else jS.Landing_Stairs.isPlaying = 0 end jS.Landing_Stairs.volPlaying = jsonTable.volume jS.Landing_Stairs.nowPlaying = jsonTable.currentTrack.artist jStateTable = json.encode(jS) fibaro:setGlobal("StateTable", jStateTable) fibaro:call(device,"setProperty","ui.lblLanding.value",""..jsonTable.playbackState.." | "..jsonTable.volume..""); -- TWINS BEDROOM response = sonos:GET("/Bed_LE/state") jsonTable = json.decode(response); if jsonTable.playbackState == "PLAYING" then zoneCount = zoneCount + 1 jS.lau_eth_bedroom.isPlaying = 1 else jS.lau_eth_bedroom.isPlaying = 0 end jS.lau_eth_bedroom.volPlaying = jsonTable.volume jS.lau_eth_bedroom.nowPlaying = jsonTable.currentTrack.artist jStateTable = json.encode(jS) fibaro:setGlobal("StateTable", jStateTable) fibaro:call(device,"setProperty","ui.lblBedLE.value",""..jsonTable.playbackState.." | "..jsonTable.volume..""); -- FRANK BEDROOM response = sonos:GET("/Bed_Frank/state") jsonTable = json.decode(response); if jsonTable.playbackState == "PLAYING" then zoneCount = zoneCount + 1 jS.frank_bedroom.isPlaying = 1 else jS.frank_bedroom.isPlaying = 0 end jS.frank_bedroom.volPlaying = jsonTable.volume jS.frank_bedroom.nowPlaying = jsonTable.currentTrack.artist jStateTable = json.encode(jS) fibaro:setGlobal("StateTable", jStateTable) fibaro:call(device,"setProperty","ui.lblBedFrank.value",""..jsonTable.playbackState.." | "..jsonTable.volume..""); -- GUEST BEDROOM response = sonos:GET("/Bed_Guests/state") jsonTable = json.decode(response); if jsonTable.playbackState == "PLAYING" then zoneCount = zoneCount + 1 jS.guest_bedroom.isPlaying = 1 else jS.guest_bedroom.isPlaying = 0 end jS.guest_bedroom.volPlaying = jsonTable.volume jS.guest_bedroom.nowPlaying = jsonTable.currentTrack.artist jStateTable = json.encode(jS) fibaro:setGlobal("StateTable", jStateTable) fibaro:call(device,"setProperty","ui.lblGuests.value",""..jsonTable.playbackState.." | "..jsonTable.volume..""); -- OFFICE response = sonos:GET("/Bed5_Office/state") jsonTable = json.decode(response); if jsonTable.playbackState == "PLAYING" then zoneCount = zoneCount + 1 jS.office.isPlaying = 1 else jS.office.isPlaying = 0 end jS.office.volPlaying = jsonTable.volume jS.office.nowPlaying = jsonTable.currentTrack.artist jStateTable = json.encode(jS) fibaro:setGlobal("StateTable", jStateTable) fibaro:call(device,"setProperty","ui.lblOffice.value",""..jsonTable.playbackState.." | "..jsonTable.volume..""); -- MASTER BED response = sonos:GET("/Bed_MasterL/state") jsonTable = json.decode(response); if jsonTable.playbackState == "PLAYING" then zoneCount = zoneCount + 1 jS.master_bedroom.isPlaying = 1 else jS.master_bedroom.isPlaying = 0 end jS.master_bedroom.volPlaying = jsonTable.volume jS.master_bedroom.nowPlaying = jsonTable.currentTrack.artist jStateTable = json.encode(jS) fibaro:setGlobal("StateTable", jStateTable) fibaro:call(device,"setProperty","ui.lblMaster.value",""..jsonTable.playbackState.." | "..jsonTable.volume..""); -- HALL response = sonos:GET("/Hallway/state") jsonTable = json.decode(response); if jsonTable.playbackState == "PLAYING" then zoneCount = zoneCount + 1 jS.hall.isPlaying = 1 else jS.hall.isPlaying = 0 end jS.hall.volPlaying = jsonTable.volume jS.hall.nowPlaying = jsonTable.currentTrack.artist jStateTable = json.encode(jS) fibaro:setGlobal("StateTable", jStateTable) fibaro:call(device,"setProperty","ui.lblhallway.value",""..jsonTable.playbackState.." | "..jsonTable.volume..""); -- KITCHEN response = sonos:GET("/Kitchen/state") jsonTable = json.decode(response); if jsonTable.playbackState == "PLAYING" then zoneCount = zoneCount + 1 jS.kitchen.isPlaying = 1 else jS.kitchen.isPlaying = 0 end jS.kitchen.volPlaying = jsonTable.volume jS.kitchen.nowPlaying = jsonTable.currentTrack.artist jStateTable = json.encode(jS) fibaro:setGlobal("StateTable", jStateTable) fibaro:call(device,"setProperty","ui.lblkitchen.value",""..jsonTable.playbackState.." | "..jsonTable.volume..""); -- PLAYROOM response = sonos:GET("/playroom/state") jsonTable = json.decode(response); if jsonTable.playbackState == "PLAYING" then zoneCount = zoneCount + 1 jS.playroom.isPlaying = 1 else jS.playroom.isPlaying = 0 end jS.playroom.volPlaying = jsonTable.volume jS.playroom.nowPlaying = jsonTable.currentTrack.artist jStateTable = json.encode(jS) fibaro:setGlobal("StateTable", jStateTable) fibaro:call(device,"setProperty","ui.lblplayroom.value",""..jsonTable.playbackState.." | "..jsonTable.volume..""); -- GARAGE response = sonos:GET("/Garage/state") jsonTable = json.decode(response); if jsonTable.playbackState == "PLAYING" then zoneCount = zoneCount + 1 jS.garage.isPlaying = 1 else jS.garage.isPlaying = 0 end jS.garage.volPlaying = jsonTable.volume jS.garage.nowPlaying = jsonTable.currentTrack.artist jStateTable = json.encode(jS) fibaro:setGlobal("StateTable", jStateTable) fibaro:call(device,"setProperty","ui.lblgarage.value",""..jsonTable.playbackState.." | "..jsonTable.volume..""); -- PIZZA BBQ response = sonos:GET("/PizzaBBQ_Area/state") jsonTable = json.decode(response); if jsonTable.playbackState == "PLAYING" then zoneCount = zoneCount + 1 jS.pizza_bbq_area.isPlaying = 1 else jS.pizza_bbq_area.isPlaying = 0 end jS.pizza_bbq_area.volPlaying = jsonTable.volume jS.pizza_bbq_area.nowPlaying = jsonTable.currentTrack.artist jStateTable = json.encode(jS) fibaro:setGlobal("StateTable", jStateTable) fibaro:call(device,"setProperty","ui.lblpizza.value",""..jsonTable.playbackState.." | "..jsonTable.volume..""); -- LIVING response = sonos:GET("/Living_Room/state") jsonTable = json.decode(response); if jsonTable.playbackState == "PLAYING" then zoneCount = zoneCount + 1 jS.living_room.isPlaying = 1 else jS.living_room.isPlaying = 0 end jS.living_room.volPlaying = jsonTable.volume jS.living_room.nowPlaying = jsonTable.currentTrack.artist jStateTable = json.encode(jS) fibaro:setGlobal("StateTable", jStateTable) fibaro:call(device,"setProperty","ui.lblliving.value",""..jsonTable.playbackState.." | "..jsonTable.volume..""); -- GARAGE response = sonos:GET("/DiningRoom/state") jsonTable = json.decode(response); if jsonTable.playbackState == "PLAYING" then zoneCount = zoneCount + 1 jS.dining_room.isPlaying = 1 else jS.dining_room.isPlaying = 0 end jS.dining_room.volPlaying = jsonTable.volume jS.dining_room.nowPlaying = jsonTable.currentTrack.artist jStateTable = json.encode(jS) fibaro:setGlobal("StateTable", jStateTable) fibaro:call(device,"setProperty","ui.lbldining.value",""..jsonTable.playbackState.." | "..jsonTable.volume..""); fibaro:setGlobal("ActiveMusicZones", zoneCount); fibaro:call(device,"setProperty","ui.activeZones.value",zoneCount); Three of my zones use power amps (the are sonos connects) and I use the ‘playstate’ to turn the amp on / off when required. That’s the code at the bottom of the vd At one stage I was even displaying the image (radio station, music album) on an openremote UI using the uri part of the state json. I use the VoiceRSS TTS on teh http api but there are others. That all that was there when I found it and it worked well I have TTS to tell me “welcome home”, “good night”, "gate opening/closing", "garage door opening/closing" and all the usual stuff but I vary the volume it at night so it doesn’t wake everybody up. I intend this expand this feedback out so If we come home and the alarm went off it would tell me or that the washing machine has finished, the humidity is still too high in the bathroom and I should open the window (or that a fan was turned on) or some HC2 system info like the available memory went beyond certain thresholds, temp in a room rose or dropped, My siemens alarm is connected to my HC2 and I keep track of all the status of the alarm zones and when we press the “Leaving Home” button it checks the alarm zones and if one or many are open, it will TTS the open alarm zones in the hall sonos so we know where to go and close. Same thing when we go to bed at night. I found that each of my zones have different volume levels that work at night and during the day. I’ll be using my HomeTable (different topic) to store this info for each zones but it can written directly into the scene/vd. (This is what the the following code is for) I also plan on using a central TTS engine (simple a scene that take a zone/message and vol) so I can TTS more easily to any player. For now I have specific TTS code on a per player basis. I leverage the global variables that @Sankotronic Weather Basic VD populates and a scene that allows me to send the current weather (temp, humidity, wind speed direction, etc) as a TTS to our bedroom in the morning as well as the temp of the house as part of our wake up routine The API has a presets concept. This allows the user to pre-define a set of grouped players, source and volume. This is a file on the rpi and is referenced by a single command rather than starting one zone and grouping other zones. An example of its structure is as follows ... { "players": [ { "roomName": "Landing", "volume": 0 }, { "roomName": "Bed_MasterL", "volume": 0 }, { "roomName": "Bed_LE", "volume": 0 }, { "roomName": "Bed_Frank", "volume": 0 } ], "pauseOthers": false, "favorite": "96FM" } You may notice that the volume is set as 0 because I use another scene to slowly raise the volume so we are not woken to the sharp shock to a loud song. This simple vd button code is what I use to slowly raise the volume slowly local device = fibaro:getSelfId(); local zonename = fibaro:getName(device); local ipaddress = fibaro:getValue(device, "IPAddress"); local port = fibaro:getValue(device, "TCPPort"); sonos = Net.FHttp(ipaddress, port); for v = 1, 10 do response = sonos:GET("/Bed_Frank/volume/"..v.."") fibaro:debug("vol= "..v.."") fibaro:sleep(1000) end I use this for morning music upstairs and downstairs as well as when the kids go to bed. (changing the presets on the rpi requires a restart of the api - i normally just reboot the pi ) Watch out for radio favorites and playlists - try and not have spaces in the names on sonos and you should have no issue calling them ADDED - Jan 21st Creating a single button on a VD to cycle through favorites or playlist instead of using 1 per favorite. Every time you click the button it selects the next favorite. I have it limited to 5 favorites but this is easily adjusted. I store the favorite in my HomeTable but it could also be a global variable. I use an array to decode the numerical value stored globally into the actual favorite so I can append to the sonos api call. This will need to be adjusted to suit your system VD button code .... local device = fibaro:getSelfId(); local ipaddress = fibaro:getValue(device, "IPAddress"); local port = fibaro:getValue(device, "TCPPort"); local jT = json.decode(fibaro:getGlobalValue("HomeTable")) -- Get the current favorite number stored, increment by 1 and if > 5 set back to 1 local f = tonumber(jT.Landing_Stairs.RadFav) + 1 if f > 5 then f = 1 end -- Store the new favorite jT.Landing_Stairs.RadFav = f fibaro:setGlobal("HomeTable", json.encode(jT)) -- Array for the favorites fav = {[1] = "4FM", [2] = "96FM", [3] = "Calm", [4] = "Heart", [5] = "Red_FM"} -- Execute the sonos conmmand sonos = Net.FHttp(ipaddress, port); response = sonos:GET("/Landing/favorite/"..fav[f]..""); I also reflect this on a status label on the VD. -- Get favorite stored globally local f = tonumber(jT.Landing_Stairs.RadFav) -- Translate into favorite name to be displayed fav = {[1] = "96FM", [2] = "4FM", [3] = "Calm", [4] = "Heart", [5] = "Red_FM"} -- fav[f] represents the name. I apppend to otehr date and display in one label local status = " "..fav[f].." | "..jTS.playbackState.." | Volume "..jTS.volume.."%" fibaro:call(device,"setProperty","ui.status.value", status); This display at the top of the VD doesn't account is somebody changes the favorite from the native sonos app. I'll add code later to keep alignment between what is selected and what is stored in the global variable, This is what it looks like on my setup that is still a work in progress x Please see post 163 on this topic on how to get the VD icons dynamic for radio station or line in
  21. Hi, Strange one for you ... I have 14 sonos zones or varying types and when I add the 12th the VD doesn't work or display anything. I think its a number related issue as I removed a few and added a few different ones and always couldn't seem to add more than 11 I tried the usual, adding/removing VD many times, fixed IP's on the zones, all SW up to date, power cycled impacted zones, removed any 'funny' characters in the room or device names running 4.080 and it's the 1.0.1b beta sonos remote Does anybody have more that 11 zones with VD and all running okay ? Thanks -Frank
  22. Hello, I'm working on a tiny lua code showing status on different variables and devices. This is what I got: local ID = fibaro:getSelfId() local lys = fibaro:getGlobal('LYS') local lysstue = fibaro:getValue(36, 'value') local TV = fibaro:getValue(85, 'value') local dor = fibaro:getValue(66, 'value') fibaro:call(ID,'setProperty','ui.Label1.value',lys) fibaro:call(ID,'setProperty','ui.Label2.value',lysstue) fibaro:call(ID,'setProperty','ui.Label3.value',TV) fibaro:call(ID,'setProperty','ui.Label4.value',dor) Only thing I want to change are values displayed as 0 and values displayed as 1 changes to "OFF" and "ON". Help is much appreciated!
  23. Hello, I thought it was time to start learning some simple lua coding. Anyhow, thought I could get some help here. I am trying to make a slider adjusting a variable that controls two different wall plugs. I want to make a slider for behaving like a thermostat. I've got two electric heating panels which is connected to two wall plugs. My thought was that if I set slider value to 21 then it would cut the power to the wall plug when netatmo reaches that temperatur. I don't really know where to begin, help would be much appreciated. Thanks!
  24. Hi, I have come across what I think is a limit to the number of words that the TTS engine can speak. The following scene lua will work --[[ %% properties %% events %% globals --]] -- Configuration - Device IDs local bid = 28 local sid = 1203 local params = { message = "the big furry cat sat on the mat", duration = 'auto', -- Duration: "auto", xx seconds language = "en-gb", -- Language: see http://www.voicerss.org/api/documentation.aspx to get your language code volume = 45, } local _f = fibaro local _x ={root="x_sonos_object",load=function(b)local c=_f:getGlobalValue(b.root)if string.len(c)>0 then local d=json.decode(c)if d and type(d)=="table"then return d else fibaro:debug("Unable to process data, check variable")end else fibaro:debug("No data found!")end end,set=function(b,e,d)local f=b:load()if f[e]then for g,h in pairs(d)do f[e][g]=h end else f[e]=d end;_f:setGlobal(b.root,json.encode(f))end,get=function(b,e)local f=b:load()if f and type(f)=="table"then for g,h in pairs(f)do if tostring(g)==tostring(e or"")then return h end end end;return nil end} -- Make a request to the remote to process params object instantly _x:set(tostring(sid), { tts = params }) _f:call(sid, "pressButton", bid) but if I replace the message line with a longer message it doesn't work. (no error is given) message = "the big furry cat sat on the mat and the dog sat on the floor", I think the limit seems to be around 46 characters (or perhaps its a time limit, ~2 seconds of speaking??) 'Guest' in the following post indicated that they had announcements that were much longer that 50 chars that were working fine with the 1.0.0 beta http://forum.fibaro.com/index.php?/topic/20662-sonos-remote-v100-beta/page-3 Is this a known issue or is there a fix out there... Thanks -F
  25. How can I press a button in a Virtual Device with a http-command? (sending from another computer) Please help!
×
×
  • Create New...