Welcome to Smart Home Forum by FIBARO
Search the Community
Showing results for tags 'best practice'.
The Fibaro community and its forums contain a lot of useful information. As several users have pointed out, however, it is often difficult to extract the really useful ideas from this format. Solutions and good ideas are frequently buried deep in a lengthy dialogue. Finding the right topic to browse is also a challenge. This is not a criticism but an inherent feature of a broad discussion forum like this one. The possibility to ask questions to other users and get useful assistance should be maintained. What I feel is needed, is a supplement: Somewhere to find a summary of best practice. Ideally, this should have been provided by Fibaro as part of their documentation. That does not seem to be happening. My suggestion, therefore, is to establish a Fibaro Best Practice Wiki, written by and for the users. A permanent structure could then serve as a depository for the solutions, the good ideas, and the best practice from the Forum discussions. This wiktionary could be the first place to look for anyone with a problem. If a solution is already described, it should be found there. If not, the user can post a question on the appropriate forum. Hopefully, this will result in a helpful answer which may then be added to the Wiki. A functional Wiki needs moderators. Again, it would be natural to look to Fibaro to fill that role, but if they do not step up to the challenge, I am sure a user-managed system can be made to work too. I do not have the tools to establish a Wiki system, and it would be premature to do so without consensus in the user community that this is a useful thing to do. I have, however, drafted an outline (see attachment) to illustrate how a Wiki may be structured. A formal outline like this is not strictly needed, of course, for a wiki system, but it illustrates what type of contributions I think we should try to build. The end result should be a compendium of all aspects of a Fibaro system. Your feedback is invited at both levels: Is the basic idea of supplementing the Forum with a collection of "best practices" sound? Is a user-driven wiki the best solution? Any alternatives? Is my table-of-contents sensible? Any suggestions to change or supplement it? Best practice structure.pdf
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