Navigation

    Discussion Forum to share and further the development of home control and automation, independent of platforms.

    SmartHome Community

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Unsolved
    (Last Updated: March 23, 2021)
    • UDP Datagrams

      therealdb

      I've implemented this:

      https://smarthome.community/topic/20/openluup-version-log/18

      into my own MQTT Server and that's cool, since I'm now pushing every variable via MQTT, originating from the Vera.

      Just a couple of questions for @akbooer

      do I need to check that sock is connected, from time to time? is there anything specifically to retry the command?

      I'm running it in the latest hour, and everything seems OK, but I want to code it for the worst situations. Thanks, always inspiring!

      Code/Snippet library
    • Luup : Whole house energy usage.

      parkerc

      Hi all

      Here’s another snippet of code I like to use, to see what’s going on.
      If anyone has any variations on this, I’d love to see it.

      local variables = {"Watts"} local NRG_SER = "urn:micasaverde-com:serviceId:EnergyMetering1" local total = 0 for lul_device in pairs(luup.devices) do local readings = {} -- create empty array called readings for _, variable in ipairs(variables) do -- using the id and value in variables table above local value = luup.variable_get(NRG_SER, variable, lul_device) local name = luup.attr_get ('name', lul_device) table.insert( readings, { variable, tonumber(value), name}) -- populate readings table end for _, reading in ipairs(readings) do local Variable = reading[1] local Value = reading[2] or 0 local Name = reading[3] or "Unknown" total = total + Value if Value ~= 0 then print(Name, Variable.. " - ".. Value) end end end print("Total watts = " ..total)
      Code/Snippet library
    • Luup : Foscam API

      parkerc

      Sharing the love...

      As I have a number of foscam cameras around the house, using their API I created the following bit of code to set to retrieve any settings across all of them, to keep them in sync.

      This one gets the device name from each of them. If anyone has any variations or ways to improve the bit of code please let me know..

      local url = require("socket.url") local URL = "http://" local username = "admin" local password = "password" local cmd = "getDevName" -- /cgi-bin/CGIProxy.fcgi?cmd=getDevName&usr=admin&pwd= local foscamsIPs = { { NO=1, IP="192.168.102.165:88", LOCATION="conservatory"}, { NO=2, IP="192.168.102.38:80", LOCATION="boiler room"}, { NO=3, IP="192.168.102.223:88", LOCATION="Living room"}, { NO=4, IP="192.168.102.245:88", LOCATION="front room"}, { NO=5, IP="192.168.102.104:88", LOCATION="kitchen"}, } for k,v in pairs(foscamsIPs) do -- Read each value. local update = URL .. v["IP"] .. "/cgi-bin/CGIProxy.fcgi?cmd="..cmd.."&usr="..username.."&pwd="..password -- do this for each reading. local status, result = luup.inet.wget(update) print(v["LOCATION"].. " status is " ..status.. " : result is " ..result) end````
      Code/Snippet library
    • Help with luup.call_delay()

      T

      I have this block of lua and I am using luup.call_delay to delay the sending of IR codes. it works as intended but I am trying to eliminate the use of luup.sleep for the delay before the tcp:close() as well. i cant figure out how to implement luup.call_delay() for the tcp:close() and keep the luup.call_delay intact for the delay between the IR codes.

      Thanks in advance.

      function Delay1() --[[HDMI Matrix B1--]] local socket = require("socket") tcp = assert(socket.connect("192.168.255.204", 4998)) tcp:send("sendir,1:3,1,38000,1,69,341,171,22,21,22,21,22,21,22,21,22,21,22,21,22,21,22,21,22,64,22,64,22,64,22,64,22,64,22,64,22,64,22,64,22,21,22,21,22,64,22,21,22,64,22,21,22,21,22,21,22,64,22,64,22,21,22,64,22,21,22,64,22,64,22,64,22,1493,341,85,22,3669" .. "\r\n") luup.sleep(1050) tcp:close() end luup.call_delay("Delay1", 1) function Delay2() --[[HDMI Matrix B2--]] local socket = require("socket") tcp = assert(socket.connect("192.168.255.204", 4998)) tcp:send("sendir,1:3,1,38000,1,69,343,171,21,21,22,21,22,21,22,21,21,21,22,21,22,21,21,21,22,63,22,63,22,63,22,63,22,63,22,63,22,63,22,63,22,63,22,63,22,63,22,21,22,63,22,21,21,21,22,21,22,21,21,22,21,21,22,63,22,21,22,63,22,63,22,63,22,1528,342,85,22,1528" .. "\r\n") luup.sleep(1050) tcp:close() end luup.call_delay("Delay2", 5)
      Code/Snippet library
    • io.popen: cannot allocate memory error

      therealdb

      I have a script calling io.popen to get the file system partition info, running on the Vera to check for space, and it's getting "cannot allocate memory error".

      Any suggestions, beside doing a luup.reload?

      Code/Snippet library
    • Something smarter than string.format for user-defined patterns?

      therealdb

      In my Virtual HTTP plugin I have patterns that could be specified to dynamically compose HTTP URLs based on current values. So, if you enter
      http://myip/color?v=%s

      it gets replaced with the current color. It's very handy when having more parameters, or if your parameter is in a different position.

      The problem is that from time to time, there are users with legitimate % in their URLs (since it's the escape char in URLs, after all) and this is causing weird behavior or crash.

      So, I want to find something smarter to support both.
      Any hints here is appreciated.

      Code/Snippet library
    • List of plugins available at the Alternative App Store

      A

      The plugins listed here are available via the Alternative App Store. The app store becomes accessible via a new menu item in the Alternative User Interface once configured.

      Both the Alternative User Interface (AltUI) and AltAppStore (AltAppStore) plugins need to be installed on Vera to access the store. With openLuup; this is all "automatically" set up and ready to go as part of the openLuup suite.

      The Alternative App Store can be found here.

      Publishing a plugin in the store is pretty easy. First your plugin code must be available in GitHub. Publish it, using the Publish command in the AltAppStore web page. You need to enter the salient information and it's ready to go.

      Plugin icons can be stored on GitHub eg like so. After a "few days" the raw json describing the plugin appears here.

      Vera 3 users should note the store will not work, as Vera 3 doesn't have the https capability required to access GitHub. However, the apps can always be downloaded from GitHub and manually installed.

      For those just interested in what the store contains; refer to the list below - as of 2021 Mar 22 there were about 74 plugins available:

      Plugin Comments Aeratron fans Alternative App Store built into openLuup ALTHue ALTUI Amcrest Dahua AutoVirtualThermostat BroadLink-Mk2 Canal Plus not in GitHub Countdown Timer originated by Futzle DALI Planet DarkSky Weather DataYours DelayLight DeusExMachina Domoticz Bridge non functional: needs work check here Domoticz Bridge 2 originated by 999LV and updated by perhusaas DreamColorLedRGB Ecobee Edisio Gateway EDS One Wire Server originated by Chris Jackson EKM metering Emby Interface Enphase Envoy Solar Monitor EventWatcher Ezlo Bridge FritzBox Sensor Google Calendar 3 Harmony Hub Control Heliotrope originated by Futzle Homebridge 2 openLuup HundredGraphs Logger IKEA Tradfri Image Map Remote Info Viewer for Vera only IPhone Locator IPX800 Irrigation Caddy KSenia Lares 16 Bridge LuaView Multi Provider Weather Station Netatmo Network Monitor OpenSprinkler OpenTherm Gateway openWeather Paradox EVO IP150 web page scrapper Pioneer Receiver Rachio Rainforest Eagle based on robertmm's work RaZberry (ALPHA) Reactor RGB Controller Rules Engine SiteSensor SMA inverter Smartmeter Reader Solar Meter Sonos originated by lolomodo and updated by toggledbits. Sony Bravia IP Surveillance Station Remote (BETA) Switchboard Telegram Tesla Car UPS Sensor UPnP Event Proxy OpenWRT only - originated by Futzle VeraAlexa Virtual HTTP Devices Virtual Pronto Remote Virtual Sensor VW CarNet WES Xee Yamaha RX HTTP Z-Way ZiBlue Gateway ZiGate Gateway
      Code/Snippet library
    • node-red Alexa OpenLuup/Vera voice integration

      Elcid

      Here is a simple integration of OpenLuup/vera device to Alexa via Node-red.

      E1cid/Node-red-Vera E1cid/Node-red-Vera

      Node-red flows for Vera. Contribute to E1cid/Node-red-Vera development by creating an account on GitHub.

      The speed is fast sub 1 second responses.

      Requirements -
      node-red.
      alexa.
      node-red-contrib-amazon-echo(local Hue devices).
      openluup or Vera (or any controller via http requests).

      Capabilities-
      Binary switch.
      dimming switch.
      rgb switch.
      Run scenes.

      Each alexa device node is configured in the topic of the amazon-echo device node -
      (device number#type of switch)
      bnary - 123#binary.
      dimming - 123#dimming.
      rgb - 123#colour (W/D is default 310 to adjust colour temp add value to end e.g. 123#colour#300
      scene - 123#scene#124 (123 on 124 off. 124 can be omitted).

      Enter the ip of your controller in the http request block.
      Just copy code and import into Node-red

      [ { "id": "de7838ac.ebead", "type": "amazon-echo-hub", "z": "8659fc6b.981b4", "port": "8980", "processinput": "0", "discovery": true, "x": 150, "y": 840, "wires": [ [ "cd0ae070.e98378", "a605448.899d8b8", "21ca89ff.b0f6ce" ] ] }, { "id": "a605448.899d8b8", "type": "amazon-echo-device", "z": "8659fc6b.981b4", "name": "bedroom four", "topic": "199#colour", "x": 410, "y": 860, "wires": [ [ "688830f.c57775" ] ] }, { "id": "21ca89ff.b0f6ce", "type": "amazon-echo-device", "z": "8659fc6b.981b4", "name": "app safe", "topic": "164#binary", "x": 390, "y": 900, "wires": [ [ "688830f.c57775" ] ] }, { "id": "cd0ae070.e98378", "type": "amazon-echo-device", "z": "8659fc6b.981b4", "name": "lounge 1", "topic": "8#dimming", "x": 390, "y": 940, "wires": [ [ "688830f.c57775" ] ] }, { "id": "688830f.c57775", "type": "function", "z": "8659fc6b.981b4", "name": "", "func": "let types = {\n \"dimming\":[\"urn:upnp-org:serviceId:Dimming1\",\"SetLoadLevelTarget\",\"newLoadlevelTarget\"],\n \"binary\":[\"urn:upnp-org:serviceId:SwitchPower1\",\"SetTarget\",\"newTargetValue\"],\n \"scene\":[\"urn:micasaverde-com:serviceId:HomeAutomationGateway1\",\"RunScene\",\"SceneNum\"],\n \"colour\":[\"urn:micasaverde-com:serviceId:Color1\",{\"tt\":\"SetColor\",\"hs\":\"SetColorRGB\",\"ct\":\"SetColorTemp\"},{\"tt\":\"newColorTarget\",\"hs\":\"newColorRGBTarget\",\"ct\":\"newColorTempTarget\"}] \t\n}\nfunction binaryPayload(device, type, turnOn, payload) {\n payload.id = \"action\";\n payload.serviceId = type[0];\n payload.DeviceNum = device;\n payload.action = type[1];\n payload[type[2]] = (turnOn === true ? 1 : 0);\n payload.message = payload[type[2]];\nreturn payload;\n}\n\nfunction dimmingPayload(device, type, level, payload) {\n payload.id = \"action\";\n payload.serviceId = type[0];\n payload.DeviceNum = device;\n payload.action = type[1];\n payload[type[2]] = level;\n payload.message = level;\nreturn payload;\n}\nfunction scenePayload(device, type, turnOn, payload) {\n payload.id = \"action\";\n payload.serviceId = type[0];\n payload.action = type[1];\n payload[type[2]] = (turnOn === true ? device[0] : (device[2] || device[0]));\n payload.message =\"Run Scene \" + payload[type[2]];\nreturn payload;\n}\n\nfunction rgbPayload(device, types, msg, payload) { \n if(msg.on === true && msg.meta.changes.on === false && msg.meta[\"input\"].on === true){\n payload = binaryPayload(device[0], types[\"binary\"], msg.on, {});\n }else if (msg.meta.changes.percentage && msg.on === true){\n payload = dimmingPayload(device[0], types[\"dimming\"], msg.percentage, {});\n }else if (msg.on === true && msg.colormode === \"hs\"){\n payload.id = \"action\";\n payload.serviceId = types[\"colour\"][0];\n payload.DeviceNum = device[0];\n payload.action = types[\"colour\"][1][\"hs\"];\n payload[types[\"colour\"][2][\"hs\"]] = msg.rgb.join(\",\");\n payload.message = msg.rgb.join(\",\");\n }else if (msg.on === true && msg.colormode === \"ct\"){\n let diff = msg.ct - (Number(device[2]) || 310);\n msg.ct = (diff < 0) ? \"D\" + Math.min(Math.abs(diff * 1.7),255).toFixed() : \"W\" + Math.abs(Math.min((diff * 1.7),255) - 255).toFixed();\n payload.id = \"action\";\n payload.serviceId = types[\"colour\"][0];\n payload.DeviceNum = device[0];\n payload.action = types[\"colour\"][1][\"ct\"];\n payload[types[\"colour\"][2][\"ct\"]] = msg.ct;\n payload.message = msg.ct;\n }\nreturn payload;\n}\n\nmsg.topic = msg.topic.split(\"#\").map(Function.prototype.call, String.prototype.trim);\nmsg.hold = msg.payload;\nmsg.payload = {};\nlet type = msg.topic[1] || \"binary\";\nif(msg.topic[1] === \"scene\"){\n msg.payload = scenePayload(msg.topic, types[\"scene\"], msg.on, {});\n}else if (msg.topic[1] === \"binary\" || msg.percentage === 0 || msg.on === false){\n msg.payload = binaryPayload(msg.topic[0], types[\"binary\"], msg.on, {});\n}else if(msg.topic[1] ===\"dimming\"){\n msg.payload = dimmingPayload(msg.topic[0], types[\"dimming\"], msg.percentage, {});\n}else if (msg.topic[1] === \"colour\"){\n msg.payload = rgbPayload(msg.topic, types, msg, {});\n}\nlet error = [\"green\", msg.topic[1] + \" | \" + msg.topic[0], msg.payload.message];\ndelete msg.payload.message;\nif (Object.keys(msg.payload).length < 1){\n error[0] =\"red\";\n error[2] =\"failed to create payload\";\n}\nnode.status({\"fill\": error[0],\"shape\":\"ring\",\"text\": error[1] + \" | \" + error[2]});\n\nreturn msg;\n", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "x": 590, "y": 940, "wires": [ [ "680d28ae.8a163" ] ] }, { "id": "680d28ae.8a163", "type": "http request", "z": "8659fc6b.981b4", "name": "Get request", "method": "GET", "ret": "txt", "paytoqs": "query", "url": "http://192.168.1.11:3480/data_request", "tls": "", "persist": false, "proxy": "", "authType": "", "x": 760, "y": 1000, "wires": [ [ "cb471442.5d60c8" ] ] } ]
      Code/Snippet library
    • Low battery alerts

      akbooer

      Moved from https://smarthome.community/topic/56/disable-vera-zwave-device-polling-at-the-device-level where you'll find the referenced code.

      Code/Snippet library
    • Get your Alexa replies to the device you've asked them to with VeraAlexa plug-in

      therealdb

      So, I was messing with my Alexa routines and ha bridge, and I want to share something very cool you could do with the ability to get the last Alexa that heard your command. I mentioned it a couple of times on the old place, but Vera's OS is missing the jq package, but openLuup could have it installed.

      Basically, just execute -lastalexa with my VeraAlexa plug-in:

      local lastAlexa = luup.call_action("urn:bochicchio-com:serviceId:VeraAlexa1", "RunCommand", {Command="-lastalexa"}, 666)

      Then use it in your scene, to dynamically generate your TTS response with the device you've asked your question seconds before!

      local temperature = 25 -- get it from your sensor luup.call_action("urn:bochicchio-com:serviceId:VeraAlexa1", "Say", {Text="Ok, outise temperature is " .. temperature .. " degree", Volume=50, GroupZones= lastAlexa, Repeat = 2}, 666

      Very cool indeed 🙂

      Code/Snippet library
    • How to parse JSON path in LUA?

      therealdb

      Hi,

      I'm working on new features for my Virtual Devices Plug-in. One of the things I want to add is the ability to poll an endpoint to get power consumption.

      So, I want to store the URL and the JSON path in a variable, but I'm confused on how to dynamically parse JSON paths in LUA.

      I have something like this in a string variable

      data.meters[1].power

      and I have to extract the corresponding value from the JSON I got over HTTP.

      Any suggestion is very appreciated. Thanks.

      Code/Snippet library
    • Humidity/Mold sensor

      therealdb

      I'm trying to write a sensor similar to this:

      home-assistant/core home-assistant/core

      :house_with_garden: Open source home automation that puts local control and privacy first - home-assistant/core

      I've already translated it to LUA, but I'm getting strange values. Maybe it's because it's not that cool yet.

      Anyone has already done something similar? I have outside and inside sensors and I want to run my de-humidifier based on certain conditions. I want to avoid condensation on the large windows. Last year I ran it based on a fixed threshold, but I want to optimize this if possible.

      Code/Snippet library
    • Best way to check for http_async?

      therealdb

      I'm trying to implement the support for http_async in my Virtual Devices plugins. From my tests, Vera's UI seems less busy, but I want to automatically detect if it's installed. Right now I'm using a code like this one:

      if pcall(require, "http_async") then else ... end

      but I'm not sure it's the best way to do it. Any one? @akbooer? Thanks!

      Code/Snippet library
    • Sun position or light sensor for blinds?

      therealdb

      I have finally integrated my new motorized (blackout) blinds in the home office, since I'm planning to mainly work from home at least since the end of the year.

      I'm quite satisfied, since I made them completely automatic, but I noticed that I have two problems:

      rainy days: I have a rain sensor for the exterior sunscreens, so I can think about moving the interior ones as well moving season: while moving them to a middle position for the night is good now at 30 minutes before sunset, I'm not sure it will be OK in autumn or winter.

      So, I was thinking about adding some logic linked to sun position, or a light sensor device.
      Any hints, before re-inventing the wheel? Thanks.

      Code/Snippet library
    • Luup : Report - Last Trip

      parkerc

      I’m sure there is a better/more polished way to do this, but this remains one of my go to report urls on Vera.

      -- http://forum.micasaverde.com/index.php?topic=52025.msg334246#msg334246 local d, n local file = io.open("/www/sb.html", "w") file:write("<head> <meta http-equiv='refresh' content='30' /> </head>\n") file:write("<style>.custom { font-size: 1em; font-family: Gill Sans Extrabold, sans-serif; padding:5px; border-collapse: collapse; border: 1px solid black; }</style><table class=custom><tr class=custom><th class=custom>Security Sensor</th><th class=custom>Last Tripped</th></tr>\n") local tt = {} for n,d in pairs(luup.devices) do if d.category_num == 4 then -- local lasttrip = tonumber(luup.variable_get("urn:micasaverde-com:serviceId:SecuritySensor1", "LastTrip", n) or 0,10) local lasttrip = tonumber(luup.variable_get ("urn:micasaverde-com:serviceId:SecuritySensor1", "LastTrip", n) or os.time()) local timeString = os.date(" %Y/%m/%d - %X", lasttrip) if lasttrip > 0 then table.insert(tt, { devnum=n, last=lasttrip, ltime=timeString }) end end end table.sort(tt, function(a,b) return a.last > b.last end) -- sort highest to lowest for n,d in ipairs(tt) do file:write("<tr class=custom><td class=custom>" .. luup.devices[d.devnum].description .. "</td><td class=custom>".. d.ltime .. "</td></tr>\n") print ( d.ltime .. ' : ' .. luup.devices[d.devnum].description .. " Sensor was last tripped") end file:write("</table>\n") file:close()
      Code/Snippet library
    • Roomba integration through Hass

      rafale77

      Responding to @PrincessClevage's request through a PM,

      I am posting my Roomba integration:

      First of course you will have to have Home Assistant installed and running. I will not be covering that.
      Then you will need to add and configure the roomba component which can now be done through the UI

      Home Assistant iRobot Roomba iRobot Roomba

      Instructions on how to integrate your Wi-Fi enabled Roomba and Braava within Home Assistant.

      I won't cover this either.

      Next, on Vera or openLuup, I used a sitesensor with the following configuration:

      Screen Shot 2020-07-10 at 10.15.55.png

      I also have a preset function loaded in my startup lua to directly send post commands to my home assistant instance which I posted here:
      https://smarthome.community/topic/39/lua-function-in-openluup-startup-lua-to-send-async-command-to-home-assistant-api

      which then enables me to create a variety of scenes triggered by the site sensor: For example disarming the site sensor docks the roomba by creating a variable watch on the arm status of the site sensor and then run this code:

      Screen Shot 2020-07-10 at 10.22.19.png

      Likewise I can get it to start cleaning from openLuup through a similar scene

      Screen Shot 2020-07-10 at 10.23.02.png

      And you can let wild of your creativity from there... I have an identical integration for the xiaomi robot and am tuning the vacuum noise according to whether I am on the same floor while the robot is cleaning...

      Code/Snippet library
    • Help with luup.chdev.sync

      therealdb

      I'm struggling to fix the code attached here

      dbochicchio/vera dbochicchio/vera

      LUA Scripts for the eZlo Vera Platform (UI7). Contribute to dbochicchio/vera development by creating an account on GitHub.

      Under certain circumstances (thanks @DesT!) I see that it's causing a luup reload infinite cycle, because child devices are being created, then deleted. Specifically, I see this in the logs:

      2020-06-01 19:35:30.482 luup.chdev.sync:: [102] Open Sprinkler Test, syncing children 2020-06-01 19:35:30.482 openLuup.chdev:: deleting [413] Daily Garden 2020-06-01 19:35:30.482 openLuup.chdev:: deleting [414] Water Level 2020-06-01 19:35:30.482 openLuup.chdev:: deleting [411] Daily Cedars 2020-06-01 19:35:30.482 openLuup.chdev:: deleting [412] St-Eustache Rules AM 2020-06-01 19:35:30.482 openLuup.luup:: device 102 'Open Sprinkler Test' requesting reload

      The devices are created (look at line 357/410), but when I call luup.chdev.sync, they got deleted. Any hints? Thanks

      Code/Snippet library
    • Virtual Rain Sensor using Site Sensor and Weatherbit API

      rafale77

      With all the acquisition of Dark Sky by Apple in the plans, I thought I would share my rain sensor setting which is used as input for my irrigation system:

      Install @toggledbits site sensor Register for a free tier account from http://weatherbit.io an pick up the API key the url I use is using forecast over 2 days (replace with your coordinates and key): https://api.weatherbit.io/v2.0/forecast/daily?lat=**yourlat**&lon=**yourlong**&key=**yourkey**&days=2 The trip expression is as follows as I also pull a variable from within the sensor variable for the calculation: tonumber(response.data[1].precip)+ tonumber(response. data[2].precip) + tonumber(getstate( 67, "urn:toggledbits-com:serviceId:SiteSensor1", "PastRain"))> 5 For display I also pull these value expressions: "Total Rain "+(tonumber(response.data[1].precip)+ tonumber(response.data[2].precip) + tonumber(getstate( 67, "urn:toggledbits-com:serviceId:SiteSensor1", "PastRain")))+" mm" "Tomorrow "+response.data[2].precip+" mm" "Today Probability "+response.data[1].pop+"%" "Tomorrow Probability "+response.data[2].pop+"%" response.data[1].precip "Today "+response.data[1].precip+" mm" "Accumulated "+getstate( 67, "urn:toggledbits-com:serviceId:SiteSensor1", "PastRain") Add a time based scene with the following lua code to record the past day rain accumulation every night at the time of your choosing (I use 23:00). Replace the sensorid variable with your sensor id) local sensorid=**yoursitesensorid** local siteid= "urn:toggledbits-com:serviceId:SiteSensor1" local current =luup.variable_get(siteid,"Value5", sensorid) luup.variable_set(siteid,"PastRain", current, sensorid)

      With this, my yard irrigation only turns on when the sensor is not tripped... meaning less than 5mm of water is accumulating across 3 days (yesterday, today and tomorrow). Adjustments in value can easily be made.

      Code/Snippet library
    • Lua Function in openLuup Startup Lua to send async command to Home Assistant API

      rafale77
      function POSTHA(path, payload, token) local async = require "http_async" local ltn12 = require("ltn12") local resp = {} async.request( { url = path, method = "POST", headers = {["Content-Type"] = "application/json", ["Content-Length"] = payload:len(), ["Authorization"] = token, }, source = ltn12.source.string(payload), sink = ltn12.sink.table(resp) }, function() end) end

      example of usage:
      define the token obtained from home assistant in the scene lua or startup lua:

      local hass_token = "*********" local path = "http://hass_ip:8123/api/services/vacuum/turn_off" local payload = [[{"entity_id": "vacuum.upstairs_roomba"}]] POSTHA(path, payload, hass_token)
      Code/Snippet library
    • Change Parameter of Z-wave device through Z-way API

      K

      Parameters of devices can be set through the api using this URL

      YOURIP:8083/ZWaveAPI/Run/devices[DEVICE#].instances[0].Configuration.Set(PARAMETER,PARAMETER_VALUE,size=PARAMETER_SIZE)

      Replace:
      YOURIP with the IP of Z-way for example 192.168.1.2.
      DEVICE# with the Z-way device # of the devices parameter you want to change
      Parameter with the parameter # you want to change
      VALUE with the Parameter value
      PARAMETER_SIZE with the size of the parameter (should be 1, 2, or 4)

      An example to change device 51's parameter 3 to a value of 1 with a size of 1:

      192.168.1.2:8083/ZWaveAPI/Run/devices[51].instances[0].Configuration.Set(3,1,size=1)

      To run it in Luup code

      local status, result = luup.inet.wget("192.168.1.2:8083/ZWaveAPI/Run/devices[51].instances[0].Configuration.Set(3,1,size=1)", 5)
      Code/Snippet library
    For those who registered but didn't received the confirmation email, please send an email to support@smarthome.community with the email you used

    UDP Datagrams

    Code/Snippet library
    2
    4
    50
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • therealdb
      therealdb last edited by therealdb

      I've implemented this:

      https://smarthome.community/topic/20/openluup-version-log/18

      into my own MQTT Server and that's cool, since I'm now pushing every variable via MQTT, originating from the Vera.

      Just a couple of questions for @akbooer

      • do I need to check that sock is connected, from time to time?
      • is there anything specifically to retry the command?

      I'm running it in the latest hour, and everything seems OK, but I want to code it for the worst situations. Thanks, always inspiring!

      akbooer 1 Reply Last reply Reply Quote 0
      • akbooer
        akbooer @therealdb last edited by

        @therealdb said in UPD Datagrams:

        do I need to check that sock is connected, from time to time?

        No, because there is no permanent connection formed in UDP. If you look on the console System > Server page you can see that it always appears unconnected:

        Screenshot_2021-03-22 openLuup(1).png

        @therealdb said in UPD Datagrams:

        is there anything specifically to retry the command?

        Again no (if you're meaning that in the context of sending a datagram) becuase there is no way of knowing whether or not it failed to arrive.

        How have you selected ALL your Vera variables? (Simply an exhaustive list of possible services?)

        therealdb 1 Reply Last reply Reply Quote 0
        • therealdb
          therealdb @akbooer last edited by

          @akbooer thanks! I've obviously included as many serviceIDs as I know. so far, so good!

          1 Reply Last reply Reply Quote 0
          • therealdb
            therealdb last edited by

            So, I've left it running all the night and it's pushing things like a pro to my MQTT broker.

            Bonus points:

            • I've finally migrated my dashboard to WebSockets, instead of long-polling. I can't finish to press a button that the UI is updated. Brilliant!
            • I've finally rewritten my own VeraBridge in C#, so no polling and less CPU usage on my Vera
            • I'll probably port more things to my C# app, at this point, since I now have sub-second updates of variables
            • I modified other parts where I was calling http endpoints from my Vera, to push UDP datagrams.

            I still must find some time to fully test openLuup's MQTT broker, but @akbooer you already gave me a lot of inspiration, as always. Thanks!

            1 Reply Last reply Reply Quote 1
            • First post
              Last post

            Welcome. If you’d like to participate in the discussion, rather than just read, then you can join the forum. As a member, you can interact with others here to share your experience and ask the questions you need answered.

            Powered by NodeBB | Contributors
            Hosted freely by PointPub Media Communications Inc. | Contact us