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


perjar

Member
  • Posts

    73
  • Joined

  • Last visited

About perjar

Profile information

  • Country
    Sweden
  • Gateway/s
    Home Center 2

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

perjar's Achievements

Learner

Learner (2/8)

10

Reputation

  1. Hi, I am having problems with accessing the HC2 web interface with Chrome and Edge on Windows since a few weeks back. Firefox works fine and so does Chromium on Raspberry OS. On Chrome and Edge, the log-in page loads fine, but nothing happens when I click on the login button. I don't even get the spinning blue balls indicating that the HC2 is processing the request. HC2 is on the latest SW, 4.620 My browser versions: Windows 10: Chrome Version 99.0.4844.51 (does not work) Edge Version 99.0.1150.39 (does not work) Firefox ESR 91.7.1 (works!) Raspberry OS: Chromium Version 92.0.4515.98 (works!) Is anyone else experiencing this problem? /P
  2. Interesting observation. I have a similar issue actually, perhaps it is the same undelying problem. In my case, it is when I use the button on the plug itself. The plug is off for a few seconds and then turns on again. Same as you, I have it low powered LED light connected. Just 4.5 W. The size of the load should not really matter, since it is a mechanical relay that handles the switching. But, the plug is aware of the load size so perhaps there is a glitch in the software. I will connect other types of load to it and see if the behaviour changes.
  3. I have a bunch of wall plugs for controlling decorative lights, especially during the dark months of the year, and some just for power metering. Nothing "critical" and nothing heavy in other words. Only small loads. I also find that the they have a very short life span. Since started to buy these back in 2017, I have purchased 6 replacement plugs. As described by others in thread, the plugs become unresponsive, via z-wave and sometimes also via the button. Sometimes the switch starts to bounce back automatically after a few seconds. Resetting/reincluding sometimes works, temporarily, but after a while they simply stop working. It is not a very stable product in my view, but they are the most compact ones on the market and the best integrated into HC2. And I find the colored ring very useful too. I use it to indicate "door locked" and such, so I have not really found an alternative. But these plugs are becoming an expensive hobby...
  4. Not sure about the issue with the IR-controlled switch. I gave up on it. Regarding using the power consumption in a block scene: Yes it is possible. You can trigger on =,<,> etc And in Lua code you can fetch the power like so: power = fibaro:getValue(the_smart_meter_device_id, "power")
  5. Hi, I am having problems making calls to a server using its hostname instead of the IP addrress. According to examples here on the forum, either way should work. The server I am trying to access is a Raspberry Pi which sits on the same local network as my HC2. Its name is raspberrypi. It can be accessed using the name raspberrypi.local from any computer on the network. Definitions: local server_IP = "192.168.1.100" local server_name = "raspberrypi.local" local server_port = 5001 local server_url = "/query" This works: local server = Net.FHttp(server_IP, server_port); local response, status, errorCode = server:GET(server_url); This generates errorcode 2: local server = Net.FHttp(server_name, server_port); local response, status, errorCode = server:GET(server_url); The only difference is that in the first example I am using the IP address and in the second I am using the hostname. Using a browser to call the same url , "http//:raspberrypi.local:5001/query", works fine so I know the server is there, listens and responds. Any ideas?
  6. Hello fellow home integrators! I have a z-wave network in place with some 50 devices and it is all controlled by a Fibaro HC2, I have no intention to swap to a new controller. Now, I would like to be able to control some of my devices via Samsung Smartthings. Has anyone succeeded with such an integration? Thanks! P
  7. I am using the idea with scenes described by petergebreuers and it works fine. My case: I have a window lamp controlled by a Dimmer 2. I have a few scenes that control this dimmer over the course of the week but sometimes I want to disable these scenes and just allow manual operation of the lamp. For this purpose, I am using S2 to indicate "Automatic" versus "Manual" mode. S1 is connected to a momentary switch and controls normal dimmer operation. S2 is connected to a toggle switch where OFF shall mean "Automatic" and On shall mean "Manual" mode. Parameter 20 is set to "0 - Momentary switch" Parameter 28 (Scene activation) is set to "1 - Functionality is activated". This sends scene id 22 if S2 is ON (hold) and 23 when S2 is OFF (release) The following scene captures that S2 goes from OFF to ON, which means that mode is set to "Manual" (954 is the device ID, hence my choice of variable name) The following scene captures that S2 goes from ON to OFF, which means that mode is set to "Automatic" An example scene making use of the mode button. The lamp is switched on when evening falls, but only if mode is "Automatic" I am using this concept in our bedrooms, allowing members of the family to easily choose if their window lamp should be controlled by the system or only by the wall switch. It eliminates the need for me to go in and change the programming as soon as they change their minds about how "automatic" their room should be. Now they can decide for themselves by flicking the switch.
  8. Version 1.0.0

    100 downloads

    Le Klint 127 Sinus Dimmable and On/off
  9. I've done some further research into the issue and found a way to address this by using some LUA code found here: http://lua-users.org/wiki/BaseSixtyFour So, here is how to add an authorization header to a HTTPClient call in a scene: function b64encode(data) local b='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' return ((data:gsub('.', function(x) local r,b='',x:byte() for i=8,1,-1 do r=r..(b%2^i-b%2^(i-1)>0 and '1' or '0') end return r; end)..'0000'):gsub('%d%d%d?%d?%d?%d?', function(x) if (#x < 6) then return '' end local c=0 for i=1,6 do c=c+(x:sub(i,i)=='1' and 2^(6-i) or 0) end return b:sub(c+1,c+1) end)..({ '', '==', '=' })[#data%3+1]) end -- A sample function with a call to an API which requires authorization function logger(msg) l=net.HTTPClient({timeout=2000}); l:request("http://x.x.x.x:xxxx/logutil", {options = {method = 'POST', headers = {['Authorization'] = 'Basic '..b64encode("username:password")}, data = json.encode(msg)}, success = function(status) -- Some code if all went well end, error = function(error) -- some code if error response end}) end
  10. How do I provide user authentication when calling from a scene with HTTPClient ? In a VD, I can use use the setBasicAuthentication method. But this does not work in a scene. Simple call in a VD, works fine: function logger(msg) l=Net.FHttp("x.x.x.x", "xxxx"); l:setBasicAuthentication("user","pass"); l:POST("/logutil", json.encode(msg)); end Same call in a scene, does not work: function logger(msg) l=net.HTTPClient({timeout=2000}); l:setBasicAuthentication("user","pass") l:request("http://x.x.x.x:xxxx/logutil",{options = {method = 'POST',headers = {},data = json.encode(msg)},success = function(status) end, error = function(error) end}) end [DEBUG] 19:41:28: 2020-11-19 19:41:28.442233 [ fatal] Unknown exception: /opt/fibaro/scenes/115.lua:31: attempt to call method 'setBasicAuthentication' (a nil value)
  11. Sharing a snippet of code I am using to handle decoding of json data to avoid runtime exceptions. Especially global variables tend become corrupt, which has forced me to introduce error handling when decoding json strings stored in global variables. In this function I am wrapping json.decode in a pcall wrapper to prevent the scene/VD to error out in a runtime exception. For debugging purposes, there is an optional argument, "label", where I can include a label/tag to make it easier to identfy the error in the debug window. function jdecode(str, label) ok, res = pcall (json.decode, str); if not ok then if not label then label = "Undefined label"; end t= os.date("%Y-%m-%d %H:%M:%S"); fibaro:debug('<span style="color:red">'..t..': Corrupt json string </span><span style="color:green">'..str..' </span><span style="color:red">at label: </span><span style="color:green">'..tostring(label)..'</span>'); res = {}; res[tostring(label)] = "Corrupt data"; end return res, ok end faulty_json = "{'a':'1','b':'2','c','3'}" -- sample calls my_table = jdecode(faulty_json) my_table, ok = jdecode(faulty_json) my_table, ok = jdecode(faulty_json,"Label_1") if not ok then --do whatever end fibaro:debug(json.encode(my_table)) Gives the following output [DEBUG] 21:45:44: 2020-10-30 21:45:44: Corrupt json string {'a':'1','b':'2','c','3'} at label: Undefined label [DEBUG] 21:45:44: 2020-10-30 21:45:44: Corrupt json string {'a':'1','b':'2','c','3'} at label: Undefined label [DEBUG] 21:45:44: 2020-10-30 21:45:44: Corrupt json string {'a':'1','b':'2','c','3'} at label: Label_1 [DEBUG] 21:45:44: {"Label_1":"Corrupt data"}
  12. In addition, the scene is not triggered if the variable is changed via the Fibaro REST API unless you also add the following in your json struct in the call: { ... "invokeScenes":true, ... }
  13. Tricky thing this problem. I still have this issue with one of my VDs. There is no error message in the debug window, it just stops executing every now and then. In my case, I can detect that the VD has stopped and can trigger a scene which restarts it. I am using the same prinicple as @sonnyboyuses, adding a line at the end of the LUA code. My code is very simple. It just adds a line with a timestamp at the end so I can trace when it happened: VD_ID = 470; self = api.get("/scenes/"..__fibaroSceneId); device = api.get("/virtualDevices/"..VD_ID); append_line = "\n".."--"..os.date("%Y-%m-%d %H:%M:%S")..": Line added by scene "..self.id..": "..self.name device.properties.mainLoop = device.properties.mainLoop..append_line status = api.put("/virtualDevices/"..VD_ID, device);
  14. Hi, I am having a hard time undestanding how to use the energy panel in HC2. It seems the graphs can never be completely trusted as they show different data depending on time window. Compare graphs 1 and 2 below. They both show power consumption for same two devices, but in graph 2 I have zoomed in a bit so the window is shorter. Graph 1: 03:30 to 13:15 Graph 2: 04:30 to 11:45 The blue line is the power consumption of my house and the red line is for my espresso maker. I first looked at time window 1 and was surprised at how little power the espresso machine used, around 600W apparently. I knew this could not be correct so I zoomed in to get a closer look. Zooming in gave a completely different graph as you can see. Now the consumption looks correct, about 1800 W. This odd behaviour is more or less standard in the energy panel.. Peak levels move up and down as you zoom in and out of the graph, making it all but impossible to get a good and trustworthy view of the data and the trends. Sometimes is looks like a device has had higher momentary power consumption then the whole house, but when I change the zoom level it becomes clear that that was not the case at all, the data was just misrepresented in the graph. Is this just a bug in the system or is there some clever thinking behing how the data is presented that is above my level of intelligence?
  15. Hi, Does anyone have a good scene or VD, or other tip, to capture peak power consumption per day for a device? I run a VD every one minute which captures the current power consumption of the device in question and stores it if it higher then any previous value during the same day. But what if power consumption peaks in between runs? my VD does not capture this. Does anyone have a solution to this? KR P
×
×
  • Create New...