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 'API'.

  • 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. Can someone help me with Node-Red? I need to tell node-Red to change a global value in HC2. Thanks for the Help
  2. I am trying to get a list of sections in house, to use in a QA. From my browser I can do a http request like: http://IP_HC3/api/sections to get this list. Is there a way to do this directly with a fibaro function? Can't find anything in the API docs.
  3. Hello, I'm trying to make a method in my C# application which either turns on or off a Wall Plug. If I'm using the POST method/devices/{deviceID}/action/{actionName} on the "FibaroIpAddress/docs" API website, it works e.g. when I type in 11 as deviceId and turnOn/turnOff in actionName. the website then tells me that the request URL will look like this: http://IpAddress/api/devices/11/action/turnOff or http://IpAddress/api/devices/11/action/turnOn In my application I then use the same request URL with the code: try { var endPoint = new Uri(url); //stores credentials for the API access var cache = new CredentialCache { { endPoint, "Basic", new NetworkCredential(userName, password) } }; // Create a new request to the URL endpoint. var request = WebRequest.Create(endPoint); // Adds credentials to the WebRequest. request.Credentials = cache; //Assign the response object of 'WebRequest' to a 'WebResponse' variable using (var response = request.GetResponse()) { //Reads everything from the API call and stores it. using (var reader = new StreamReader(response.GetResponseStream())) { toReturn = reader.ReadToEnd(); } } } catch (UriFormatException e) { Console.WriteLine("Error:" + e); } But nothing happens when this runs. I've also tried this code: // Creates a endpoint to the url. var endpoint = new Uri(url); // Creates credentials for the endpoint. var cache = new CredentialCache { { endpoint, "Basic", new NetworkCredential(userName, password) } }; // Creates a new request and sets credentials. var request = (HttpWebRequest)WebRequest.Create(endpoint); request.Credentials = cache; // Specifies request. request.Method = "POST"; request.ContentType = "application/json"; request.Timeout = 5000; // Gets a streamObject to use to write request data. var dataStream = request.GetRequestStream(); // Sends the data. dataStream.Flush(); But nothing happens here either. I've use the same code for different GET requests or PUT requests (e.g. change name of device) and it works. I've also tried to just run the request URL directly into my browser, but nothing happens there either. Does someone know what I'm doing wrong?
  4. Hi Everyone. So, firstly a bit of background. I am playing with improving the current SONY TV control. Currently there is only one working control and that is the current VD, but there is a PLUGIN that doesn't work for the newer Android tv's So after a lot of head scratching and googling i have figured that the Sony TV has a REST API that can be connected to with a HTTP request. The Sony actually has three ways to control it IRCC (IR codes over IP), Serial and REST API. the current VD uses IRCC and cant go directly to say HDMI3 or an app you have installed. This is where the REST API is far better. I have figured out the syntax for the HTTP call to get it work with the help of a program called POSTMAN and i can do all sorts of control. End background..... But here is where i am falling short, the trick with the HTTP string is in the header (it must be in the header AFAIK) it needs to have, at least: Header KEY = x-auth-psk Value = 0000 KEY = host Value = 192.168.1.12 (IP of the originating unit) in the body you send (no quotes) "{"method":"setPowerStatus","version":"1.0","id":1,"params":[{"status":true}]}" That will turn the TV on. So playing with a few other Virtual Drivers for other integration I somewhat understand the GET command. (this is from the "control by web" web relay driver) GET /state.xml?relay1State=1&noReply=1 HTTP/1.1 0x0D0x0A0x0D0x0A So i understand the GET part of the statement, but then i run into the HTTP/1.1 part. I cant find anything that explains the HTTP/1.1 and what it needs what options it has and how I need to use it. For instance, why does it need a HEX string that says (no quotes) 'Carriage return 'newline' 'carriage return 'new line' So can anyone point me at the correct learning section or help me out with a command that can integrate x-auth-psk as the key and 000 as the value into the header of a HTTP request? That command will just turn the TV on, but you can string them together. Why? Imagine this: while sitting on you couch watching TV, your CCTV/IPC NVR closes one of its alarm contacts on say motion detection. I would like to know that there is motion on my security cameras while i am at home...... So a scene could be run in combination with the Virtual Driver to: Test if the TV power is on. Test if the PLEX or NETFLICK app is running Record current state Pause current state ( ie pause video or movie) Change the input to HDMI3 (to view the cameras directly from the NVR output.) wait till alarm is cleared (lets say motion) return to Plex or netflicks All of that would very VERY hard to do with IR codes. Fodder.
  5. Hi I'm trying to access the Fibaro API from a M5Stack-device. I'm already interfacing a Homey to my HC2 using "embedded user/password" in the url...and this works. On on the M5Stack i get a 401/(unauthorized access) in return when using the "embedded username/password" approach, so I guess that this is not a feasible way. It seems that i need to enter the url (which should be ok), and some information in as "headers" and "data". It's probably in there I need to enter the username and password....as well as "Content-type"?? Can anyone point me in the correct direction...what information to put where?
  6. Greetings, I see there is a value "atHome" for every user on HC2. Can be changed by API? It looks very promising for alarm functionality.
  7. Witam, mam problem z jedną sceną, chciałem żeby akcja wykonywała się tylko kiedy jestem w domu, niestety nie działa. Jedną z rzeczy jakie próbowałem to poprawienie lokalizacji domu na mapie. Nie wiele to daje, ale w związku z tą mapą to dlaczego widnieje na niej napis że jest tylko do celów developerskich? Fibaro nie zapłaciło licencji dla Google? To tak można? Spróbowałem zaktualizować lokalizację z api i tu kolejne rozczarowanie, fibaro ma nowy typ odpowiedzi na request w postaci restartu centralki. Ręce opadają. Może ktoś miał podobne problemy z scenami z lokalizacją? Czego jeszcze spróbować?
  8. I try to build a scene that can search by the ip address of VD and return the device id. I have the following code just to display all the VDs that have IP but I do get nothing.... any help? --[[ %% properties %% events %% globals --]] local devs = api.get('/devices') for k,v in ipairs (devs) do -- fibaro:debug("01") local v2 =api.get("/devices/"..v.id) -- fibaro:debug(v2.id) for m,n in ipairs (v2.properties) do fibaro:debug(n.ip) if n.ip=="192.168.13.12" then fibaro:debug("device IP found") else fibaro:debug("Not Found!") end end end
  9. 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
  10. Hi API -> How can i read the latest events from a device. I need the device ID. not all Only from a device ID. - > http://192.168.11.111/api/panels/event?last=10&type=id Thank you.
  11. Hi, Hopefully this an easy one... I have a HEM ( I think its a 1, 60A 1 clamp) and I'm running 4.100 It's on the main feed into my consumer electricity panel for my house In the energy consumption panel I can see the watts and also in the device view ( watts and accumulated kwh) If I check through the API I can see the volts / Amps value but the watts and kwh are showing as 0.00 KWH/WATTS {"id":1475,"name":"House Watts","roomID":234,"type":"com.fibaro.energyMeter","baseType":"com.fibaro.meter","enabled":true,"visible":true,"isPlugin":false,"parentId":1471,"remoteGatewayId":0,"interfaces":["energy","power","zwave"],"properties":{"parameters":[{"id":3,"lastReportedValue":1,"lastSetValue":1,"size":1,"value":1},{"id":5,"lastReportedValue":50,"lastSetValue":50,"size":2,"value":50},{"id":6,"lastReportedValue":50,"lastSetValue":50,"size":2,"value":50},{"id":7,"lastReportedValue":50,"lastSetValue":50,"size":2,"value":50},{"id":9,"lastReportedValue":10,"lastSetValue":10,"size":1,"value":10},{"id":10,"lastReportedValue":10,"lastSetValue":10,"size":1,"value":10},{"id":11,"lastReportedValue":10,"lastSetValue":10,"size":1,"value":10},{"id":101,"lastReportedValue":14,"lastSetValue":14,"size":4,"value":14},{"id":102,"lastReportedValue":590080,"lastSetValue":590080,"size":4,"value":590080},{"id":103,"lastReportedValue":2049,"lastSetValue":2049,"size":4,"value":2049},{"id":111,"lastReportedValue":-740793856,"lastSetValue":-740793856,"size":4,"value":-740793856},{"id":112,"lastReportedValue":120,"lastSetValue":120,"size":4,"value":120},{"id":113,"lastReportedValue":1800,"lastSetValue":1800,"size":4,"value":1800}],"zwaveCompany":"AEON Labs","zwaveInfo":"3,3,67","zwaveVersion":"1.19","pollingTimeSec":0,"configured":"true","dead":"false","deviceControlType":"0","deviceIcon":"102","emailNotificationID":"0","emailNotificationType":"0","endPointId":"1","energy":"1.85","liliOffCommand":"","liliOnCommand":"","log":"","logTemp":"","manufacturer":"","markAsDead":"true","model":"","nodeId":"212","parametersTemplate":"317","power":"691.92","productInfo":"0,134,0,2,0,28,1,19","pushNotificationID":"0","pushNotificationType":"0","remoteGatewayId":"0","saveLogs":"true","serialNumber":"","showEnergy":"true","smsNotificationID":"0","smsNotificationType":"0","unit":"kWh","useTemplate":"true","userDescription":"","value":"0.00"},"actions":{"reconfigure":0,"reset":0},"created":1476812003,"modified":1476812003,"sortOrder":430} VOLTS {"id":1476,"name":"House Volts","roomID":234,"type":"com.fibaro.multilevelSensor","baseType":"com.fibaro.sensor","enabled":true,"visible":true,"isPlugin":false,"parentId":1471,"remoteGatewayId":0,"interfaces":["zwave"],"properties":{"parameters":[{"id":3,"lastReportedValue":1,"lastSetValue":1,"size":1,"value":1},{"id":5,"lastReportedValue":50,"lastSetValue":50,"size":2,"value":50},{"id":6,"lastReportedValue":50,"lastSetValue":50,"size":2,"value":50},{"id":7,"lastReportedValue":50,"lastSetValue":50,"size":2,"value":50},{"id":9,"lastReportedValue":10,"lastSetValue":10,"size":1,"value":10},{"id":10,"lastReportedValue":10,"lastSetValue":10,"size":1,"value":10},{"id":11,"lastReportedValue":10,"lastSetValue":10,"size":1,"value":10},{"id":101,"lastReportedValue":14,"lastSetValue":14,"size":4,"value":14},{"id":102,"lastReportedValue":590080,"lastSetValue":590080,"size":4,"value":590080},{"id":103,"lastReportedValue":2049,"lastSetValue":2049,"size":4,"value":2049},{"id":111,"lastReportedValue":-740793856,"lastSetValue":-740793856,"size":4,"value":-740793856},{"id":112,"lastReportedValue":120,"lastSetValue":120,"size":4,"value":120},{"id":113,"lastReportedValue":1800,"lastSetValue":1800,"size":4,"value":1800}],"zwaveCompany":"AEON Labs","zwaveInfo":"3,3,67","zwaveVersion":"1.19","pollingTimeSec":0,"configured":"true","dead":"false","deviceControlType":"0","deviceIcon":"47","emailNotificationID":"0","emailNotificationType":"0","endPointId":"1","liliOffCommand":"","liliOnCommand":"","log":"","logTemp":"","manufacturer":"","markAsDead":"true","model":"","nodeId":"212","parametersTemplate":"317","productInfo":"0,134,0,2,0,28,1,19","pushNotificationID":"0","pushNotificationType":"0","remoteGatewayId":"0","saveLogs":"true","serialNumber":"","smsNotificationID":"0","smsNotificationType":"0","unit":"V","useTemplate":"true","userDescription":"","value":"237.36"},"actions":{"reconfigure":0},"created":1476812003,"modified":1476812003,"sortOrder":406} AMPS {"id":1477,"name":"House Amps","roomID":234,"type":"com.fibaro.multilevelSensor","baseType":"com.fibaro.sensor","enabled":true,"visible":true,"isPlugin":false,"parentId":1471,"remoteGatewayId":0,"interfaces":["zwave"],"properties":{"parameters":[{"id":3,"lastReportedValue":1,"lastSetValue":1,"size":1,"value":1},{"id":5,"lastReportedValue":50,"lastSetValue":50,"size":2,"value":50},{"id":6,"lastReportedValue":50,"lastSetValue":50,"size":2,"value":50},{"id":7,"lastReportedValue":50,"lastSetValue":50,"size":2,"value":50},{"id":9,"lastReportedValue":10,"lastSetValue":10,"size":1,"value":10},{"id":10,"lastReportedValue":10,"lastSetValue":10,"size":1,"value":10},{"id":11,"lastReportedValue":10,"lastSetValue":10,"size":1,"value":10},{"id":101,"lastReportedValue":14,"lastSetValue":14,"size":4,"value":14},{"id":102,"lastReportedValue":590080,"lastSetValue":590080,"size":4,"value":590080},{"id":103,"lastReportedValue":2049,"lastSetValue":2049,"size":4,"value":2049},{"id":111,"lastReportedValue":-740793856,"lastSetValue":-740793856,"size":4,"value":-740793856},{"id":112,"lastReportedValue":120,"lastSetValue":120,"size":4,"value":120},{"id":113,"lastReportedValue":1800,"lastSetValue":1800,"size":4,"value":1800}],"zwaveCompany":"AEON Labs","zwaveInfo":"3,3,67","zwaveVersion":"1.19","pollingTimeSec":0,"configured":"true","dead":"false","deviceControlType":"0","deviceIcon":"47","emailNotificationID":"0","emailNotificationType":"0","endPointId":"1","liliOffCommand":"","liliOnCommand":"","log":"","logTemp":"","manufacturer":"","markAsDead":"true","model":"","nodeId":"212","parametersTemplate":"317","productInfo":"0,134,0,2,0,28,1,19","pushNotificationID":"0","pushNotificationType":"0","remoteGatewayId":"0","saveLogs":"true","serialNumber":"","smsNotificationID":"0","smsNotificationType":"0","unit":"A","useTemplate":"true","userDescription":"","value":"4.28"},"actions":{"reconfigure":0},"created":1476812003,"modified":1476812003,"sortOrder":408} Does anybody know how to read the watts successfully or is there another clamp meter that works reliably with the HC2 I recently got a 2.6 kw PV array installed and I'm trying to monitor what I am using v generating any help appreciated Thanks -f
  12. Hi, All ! We are software company from Ukraine. And we are pleased to announce the release of our app for AppleTV, based on official Fibaro API: https://itunes.apple.com/app/smartiq/id1129869796?mt=8 The application is designed to easy management the devices connected to the FIBARO® System and to displaying their current status on your TV. Application requires FIBARO Home Center 2/or and FIBARO Home Center Lite. Features: - Displaying "favorite devices" state on TopShelf - Lighting/ temperature/ humidity/ security system control - Possibility to display current power consumption - Possibility to display battery status for a battery-powered devices. We'd love to hear your suggestions, comments, suggestions and ideas for further application development. Here is the 10 promo codes for free download the app. FKYEPWAALK6P YA7934PAY436 TRELNNWKJJ3J NPPM73MKT6FA MHEW46FL9J6T 4R9M97KMMNKL FKPX7FRKPJYY H47L46YY7M3T 6WPKKXJ6N9WL XPJL46WAJKJH Valeriy
  13. Hi I tried to use a Hue API command in my scene, but it's not working. I copied the LUA code from a working Hue VD and modify a bit, as the original is to switch off a Hue. I'd like to switch "group/0" in Hue-bridge to turn off all hue lights at once. here is how it looks like and is not working. I guess the problem is : Hue = Net.FHttp(hueIP,huePort) response ,status, errorCode = Hue:PUT('/api/'..hueuser..'/groups/0/action', '{"on":'..on..'}') Any help on that is welcome
  14. I like to initialize an empty table (like HomeTable) from a scene if it is not exist. I tried the simple following lua code but it fails. -- Check if variable exist if (fibaro:getGlobal(DDDTable) == nil) then fibaro:debug("Creating Variable Table "..varName) jsonDDD = { settings = { version='0.1' }, } jDDDTable = json.encode(jsonDDD) fibaro:setGlobal("DDDTable", jDDDTable) -- store table in global else fibaro:debug('Existing Variable') end It sounds crazy but I stuck on this point for 2 days...and my Bosch/Siemens Home-Connect project (I will share it with you guys) is on halt due to this **small** detail. Any help is more than welcome! P.S. @10der I know that you help people (high appreciate, thank you) like me on first steps... what a fool....! here is the code: api.post("/globalVariables", { name="testTable", value="Table", -- optional }) -- Modify existing variable to "predefined" style api.put("/globalVariables/testTable", { name="testTable", value="Table", -- optional isEnum=true, enumValues= { "Table", } }) here is the source: Another question is howto check if a variable is a table or something gone wrong during writing (human interaction).
  15. HI, Is it possible to create a variable (specifically a predefined variable) As part of creating a VD I want to create the variable on the fly I looked at the developer documentation but couldn't find anything Is this possible ? Thanks -f
  16. Hi, I have a strange issue. I am trying to do an API call to my HCL from the commandline: local config=assert(io.popen('curl -s "http://username:[email protected]:80/api/devices/118"')) and then do a json decode in order to retrieve the value of 'value' (true of false) The device is a Fibaro Motionsensor, but I don't get a respons, only a nil return. I use 'retrievedvalue = properties.value' If I do the same for this call: config=assert(io.popen('curl -s "http://username:[email protected]:80/api/weather"')) and retrieve value 'Temperature', it works perfect Is there anything different from calling a Fibaro device? How to get it working? I am on software version 4.170 for the HCL Thx, Rik
  17. I have a itho ventilation box, wich can be switched with a wifi rf remote. In a browser it works fine, but not in a VD... How do i do this? Commands are; http://192.168.1.116/api?action=Low http://192.168.1.116/api?action=Medium http://192.168.1.116/api?action=High The box is in the same LAN
  18. Hello, Is it posible to send text to a cell in a Google spreadsheet from Fibaro Lua? My central heating is a zone-heating controlled bij a Fibaro HC2 with zwave Secure thermostats in every room in my house. The heating works by a central gas boiler and electric Heimeier valves with Fibaro relais I like to log the on/off times (then i can calculate the heating minutes per day) so that i can show it in a graph according to the room temperature and outside temperature. With this information i can make my heating even smarter, i can automatically calculate the starting time to heat in the morning depending on the room and outside temperature to reach a certain temp at 9:00 If sending text to a external document is possible it can be used for a lot of other things: - Temperature logs (pir/smoke sensor) - Room usage (pir) - Usage of devices (koffeemachine, radio, tv, computer, lights, .....) - Graphical views - ......
  19. Hi all, I tried to find similar topic, but without expected success. I'm wondering if it is possible to import the "OUTDOOR AIR QUALITY" indicator from NETATMO sensor to the LUA scene via API? Has anyone of you tried similar solution or maybe wrote a scene which can perform such action? Your advice would be much appreciated. Thanks
  20. Witam, Panowie i Panie oraz drogie wsparcie Fibaro. Nie bardzo wiem w jakom watku umiescic tego posta, dlatego umieszczam go tutaj. Mam nastepujace pytania: 1. Kiedy bedzie wypuszczony nowy plugin do satel integra, ktory bedzie poprawnie obslugiwal Integre 256 ? - to raczej pytanie do fibaro 2. Czy mozna z bloczkow uzbroic strefe w satelu ? -> jakos mi to nie dziala. Rusza z LUA po zmianie z armed na arm. 3. Czy jest jakas komenda w lua do uzbrojenia strefy w satelu z opcjami (takimi jak w satelu 0-wszystko 2-bez wewnetrznych) ? 4. Jak podmienic ikonki czujnikow satela w fibaro ? Pozdrawiam serdecznie Leszek
  21. Hi to all, Sorry if I started a new discussion but I don't find information about my doubt. My main need is to send some information from an external server to HC2 ... to a scena ... or a virtual device... I try to call HC2 through API from another server using REST API but i cannot find the correct syntax to ... for examples "press a button " in a virtual devices... There is someone that can help me? Thanks a lot in advance Paolino
  22. Hello guys! I come from a *nix background and would like to push changes to my LUA scripts to the HC2 without having to copy/paste into a web console. This also makes it a lot easier to have everything under source control. Has anyone taken the time to create scripts for this?
  23. Hi, I need an as complete list as possible of device actions that you may envoke in Lua that takes an additional argument. (That is, not "turnOn", because this is the entire command.) These are the ones that I have found in when going through my devices: "setValue" "setSetpointMode" "setThermostatSetpoint" (2 arguments) "setMode" "setFanMode" "setVolume" "setInterval" "setSlider" (2 arguments) "setProperty" (2 arguments) "pressButton" Have I missed some command? Please note that I need only Actions that a device can perform, not all calls you can make on a device to ask it about its state. Fredrik
  24. My HC2 with firmware 4.140 does not list all registered devices when I do a ///api/devices. It only returns 10 devices in the JSON response array. When I try to access a device that is not listed in this response I get a "404 page not found" error. Some background: I have only installed the HC2 a few days ago. The first devices I registered appear in the JSON device list. Then I moved the HC2 to another floor and registered more devices. These devices do not appear in the JSON, although they work perfectly fine in the HC2 GUI. I have also rebooted the HC2, but it still won't allow API access to all devices. Any idea what's happening here? Thank you for your assistance Thomas
  25. All I tend to be a little lazy when using API calls from LUA in VD and Scenes. I also recently spotted "api.get" in some posts but have seen any information on that in ip/docs or the various fibaro websites. For those that are considerably more professional in the LUA and Fibaro development than me, could you comment on your best practice e.g. error handling, debugging, parsing JSON etc. I will try to curate and consolidate in the first entry of this topic for everyone's benefit. Tutorial for API in VD and scenes by the prolific AutoFrank Also, I should of thought Wikipedia for HTTP error codes. Wikipedia HTTP Error Codes So perhaps comment away on the extract from my announcer VD that uses jishi SONOS API bridge below and lets make that a good example of best practice for those learning the ropes (me included)? thanks in advance local device = fibaro:getSelfId(); local ipaddress = fibaro:getValue(device, "IPAddress"); local port = fibaro:getValue(device, "TCPPort"); local cmd = "/sayall/" local vol = "/50" Debug(true,"white","Ready to send to "..ipaddress..":"..port) Debug(true,"white", "Raw:"..cmd.."Hello"..vol); -- use an encodeTSS function here in cmd = cmd .. encodeTTS(announce).. vol; -- Issue API call sonos = Net.FHttp(ipaddress, port); response, status, errorcode = sonos:GET(cmd); -- simple error checking if tonumber(status)==200 then response=json.decode(response) else Debug(true,"red","Error calling Sono API:"..errorcode.." status: "..status); end
×
×
  • Create New...