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
    1. Home
    2. parkerc
    • DelayLight replicate in MSR

      P

      Hi Everyone,

      I am just starting to move over from Vera to Home Assistant using MSR.

      On vera I had been using DelayLight. I have tried to replicate it with help from youtube (https://www.youtube.com/watch?v=fc_ij0D1hXE) Reactor for Vera #006 - Emulating DelayLight in Reactor.

      I have created 6 rules that sort of work. but I am just wondering if this is best practice or should can it be built in 1 rule like the old vera way?

      Multi-System Reactor
    • Home Assistant add-on

      M

      I've done a bit of repackaging of MSR to make it work as an add-on under Home Assistant mostly for my own purposes but hopefully it makes it a bit easier to install and get going.

      GitHub - mrw298/hassio-reactor-addon GitHub - mrw298/hassio-reactor-addon

      Contribute to mrw298/hassio-reactor-addon development by creating an account on GitHub.

      Multi-System Reactor
    • Having an Echo device play mp3?

      F

      Hi!
      I tried to find an answer in both the forum and by myself, without any luck. I'm trying to make my Echo device play a mp3 file. The same mp3 file is easy to play with other smart speakers (Sonos, Google/Nest) - that it no problem. Same approch do not work with Echo devices. The mp3 files I want to use is located on my HA installation (config/www/audio), running on ver. 2023.5.4. I have MSR ver 23114.
      Is there a way to do this easily?
      Thanks!
      /Fanan

      Multi-System Reactor
    • Reactor (Multi-System/Multi-Hub) Announcements

      toggledbits

      Build 21228 has been released. Docker images available from DockerHub as usual, and bare-metal packages here.

      Home Assistant up to version 2021.8.6 supported; the online version of the manual will now state the current supported versions; Fix an error in OWMWeatherController that could cause it to stop updating; Unify the approach to entity filtering on all hub interface classes (controllers); this works for device entities only; it may be extended to other entities later; Improve error detail in messages for EzloController during auth phase; Add isRuleSet() and isRuleEnabled() functions to expressions extensions; Implement set action for lock and passage capabilities (makes them more easily scriptable in some cases); Fix a place in the UI where 24-hour time was not being displayed.
      Multi-System Reactor
    • Sending numbers as payload type in actions enhancement

      J

      I'm controlling a HVAC device through the MQTTController. While setting up the entity config in reactor.yaml, I started with this on the action block:

      set_setpoint: topic: "ezlo_mqtt/set/item/%topic%/set/Tsetpoint" payload: expr: "parameters.setpoint" type: raw

      However, as the setpoint is a number in the UI, things were not fully parseable as a number and nothing was outputted to mqtt.

      So I've added this code to MQTTController.js at line 1449 to add the payload type 'number':

      } else if ( 'number' === act.payload.type ) { payload = String( payload ); } else if (''raw' !== ( act.payload.type || 'raw' ) ) {

      After this change, I was able to set the payload type to number:

      set_setpoint: topic: "ezlo_mqtt/set/item/%topic%/set/Tsetpoint" payload: expr: "parameters.setpoint" type: number

      And things worked as intended, being able to send numbers in the actions bit of a rule set.

      Multi-System Reactor
    • MIOS - UI5 web login

      Black Cat

      Can anyone help with the MIOS UI5 weblink? Not the getvera one.
      Still running UI5 on a couple of sensors & lights and need to tweak PLEG but for the life of me I can't remember the link to tunnel back to the trusty machine....

      General Discussion
    • SiteSensor > how to fill in Value Expressions (json data) SOLVED !

      M

      I still use Vera controllers in combination with ReactorSensors. I have several Reactor sensors in use to retrieve weather data from Wunderground (i have a personal weather station), my smartmeter etc.

      Recently I installed solar panels with a SolarEdge inverter. SolarEdge has an API to retrieve my power production data from their cloud.
      Output is in json.

      So I created a new Reactor Sensor. Connection is working (query okay).
      But I encounter problems at the Value Expressions. Either I get ""query okay" but no data or I get "query okay but 1 expressions failed"

      This is the json output

      {"overview":{"lastUpdateTime":"2023-05-12 10:45:57","lifeTimeData":{"energy":476310.0,"revenue":216.577},"lastYearData":{"energy":433001.0},"lastMonthData":{"energy":433001.0},"lastDayData":{"energy":8262.0},"currentPower":{"power":5647.0},"measuredBy":"INVERTER"}}

      So it has different layers/levels.

      I tried to put in the Value Expressions field several combinations to get the energy data of today (8262.0), like:

      response.lastDayData.energy
      response.overview.lastDayData.energy
      response.overview.lastUpdateTime.lastDayData.energy

      all fail...

      Who can help me with this ?

      Vera/openLuup plugins
    • openweather plugin ?

      DesT

      Hey guys....

      long time 😉

      Since Dark weather is no more active, thanks Apple. Anyone switch to openweather to get weather data ?

      Plugins
    • Smart devices and mesh

      J

      The wifi on my router is turned off, and wifi around the house is provided using a mesh - 3 units altogether (one connected directly to the router) that are spread around the house.

      I would like to start automating certain tasks around the house and intend to try adding a few smart sockets to my setup.

      The mesh system I have supports both 2.4GHz and 5GHz, and does not provide me with the option to control them - i.e. turn one or both on/off, give each a different SSID, etc.

      The devices I wish to purchase/use only support 2.4GHz.

      Will turning the mesh units off and temporarily turning the 2.4GHz wifi on the router to allow me to set them up be enough? Will I then be able to return to my usual setup and everything will work as it should?

      Many thanks in advance

      General Discussion
    • Smart bed sensor

      C

      Hey everyone, I'm currently working on developing a bed sensor that can detect when you're out of bed. It could be used to trigger other smart home gadgets, like lights or blinds, temperature etc.
      The sensors are placed under the legs of your bed post. Should look and feel like "smart furniture pads" with size 2 inches in diameter and 1/4 inch thick.
      Before we go any further, I'd love to get your thoughts on this - would a bed sensor like this be something you'd find useful? We're still in the early stages of development, so any feedback you have would be greatly appreciated. Thanks in advance!

      smart möbeltass.JPG

      General Discussion
    • JSON payload in MQTTController entities actions (+ reverse color mapping to RGB)

      M

      Some background
      I'm trying to integrate a Zigbee device into the MSR using zigbee2mqtt bridge and MQTTController. The device in question is a cheap mood light that has following properties that I'd like to control:

      switch (on/off) brightness color

      I'v already managed to get the switch part working and can toggle the light on/off. Also the brightness value is mapped back to MSR. In zigbee2mqtt it has a value range from 0 to 254, so this the reason for the expression:

      expr: 'payload.brightness / 254'

      Here's the entity definition (don't know whether the type should be something else than the Switch)

      zigbee-lidl-mood-light: name: 'Lidl Mood Light' friendly_name: 'Mood Light' type: Switch uses_template: lidl-moodlight

      And the corresponding template (NOTE: rgb_color has not been defined in this example):

      lidl-moodlight: init: "zigbee2mqtt/%friendly_name%/get/state" query: "zigbee2mqtt/%friendly_name%/get/state" capabilities: - power_switch - toggle - dimming primary_attribute: power_switch.state events: "zigbee2mqtt/%friendly_name%": "power_switch.state": json_payload: true expr: 'upper(payload.state) == "ON"' "dimming.level": json_payload: true expr: 'payload.brightness / 254' actions: power_switch: "on": topic: "zigbee2mqtt/%friendly_name%/set/state" payload: 'ON' "off": topic: "zigbee2mqtt/%friendly_name%/set/state" payload: 'OFF' set: topic: "zigbee2mqtt/%friendly_name%/set/state" payload: expr: "parameters.state ? 'ON' : 'OFF'" type: raw toggle: topic: "zigbee2mqtt/%friendly_name%/set/state" payload: 'TOGGLE'

      The problem
      In order to control the brightness or the RGB color values, I would have send a JSON payload in corresponding actions. But I have no idea how to define it in the template. The reason why the switch part is working is that the zigbee2mqtt accepts also plain ON / OFF / TOGGLE string payloads in that case.

      But the brightness should be controlled with the following payload:

      {"brightness": 196}

      And the RGB color like:

      {"color":{"rgb":"46,102,150"}}

      Here's the link for the documentation (the Exposes part defines the messages).

      So how should I define the JSON payload for example for the dimming action? It definitely should be some sort of expressions since I have to map the MSR real value (0...1) to (0...254) for the zigbee2mqtt.

      actions: dimming: set: topic: "zigbee2mqtt/%friendly_name%/set" payload: expr: ????? type: json

      Another problem is the RGB value. I could use the rgb_color capability for the setting but the problem is that the zigbee2mqtt only reports the current color in hue/saturation or xy coordinates.

      Here's an example of published message after setting the color:

      Topic: zigbee2mqtt/Mood Light QoS: 0 { "brightness":254, "color":{ "hue":240, "saturation":100, "x":0.1355, "y":0.0399 }, "color_mode":"xy", "color_temp":574, "linkquality":96, "state":"ON" }

      I would have to map those values back to RGB, but is it even possible with existing constructs in MQTTController's templates?

      Help would be appreciated @toggledbits
      br,
      mgvra

      Multi-System Reactor
    • Another Vera --> Home Assistant migration question

      T

      Good morning all,
      I've got a stable Home Assistant running on a RPI 4 with a Aeotec Z-Stick 7 Plus, and of course the Z-wave JS integration. I've manually moved a handful of devices, and I'm overall much happier with the HA z-wave capability than I am with Vera. There are still some things I'm trying to figure out that I have in Vera that I'm not sure how they'll work in HA, but no deal breakers.

      I've got all of my automation on MSR and off of luup Reactor, so really the only thing left for me is to migrate my Z-wave network. I saw @rafale77's post about using a Zwave.me UZB1 to Zway, but of course that's not what I'm using.

      Is there a similar method that I can use my Aeotec Z-Stick 7 plus to Home Assistant? I have around 70 Z-wave devices (give or take devices that generate multiple instances in Vera), so manual unpairing, including, etc, would be quite a chore.

      Vera
    • Home Assistant push notification for Reactor version update possible?

      T

      Good evening,
      I was wondering if it would be possible to send out a push notification when there is a update to MSR to HA users. I know how to set up notifications through Reactor to HA users, but I'm unsure what to look for in regards to updates. I know that MSR itself will tell me there is an update, but unless I'm logged into MSR in a browser, I'm not always going to see that.

      Just updated to latest-23114-e4060aae MSR
      Home Assistant 2023.4.6
      Supervisor 2023.04.1
      Operating System 10.0

      Multi-System Reactor
    • ChatGPT - finally I can now retyre in piece and quite, knowing everting is in goof hands.

      A

      ChatGPT samples:

      Me:

      Tell me about an iot program called openLuup.

      It:

      OpenLuup is an open source home automation system that is built on the VeraLuup platform. It is designed to be easy to install and configure, and provides users with a powerful and versatile way to control their home automation devices. OpenLuup offers a wide range of features, including support for many popular home automation devices, scheduling, scripting, and integration with other services. OpenLuup is designed to be customizable, allowing users to create their own home automation systems. It is an excellent choice for those looking to create their own home automation system without spending a lot of money.

      Me:

      Write an iot program using openLuup.

      It:

      --openLuup IoT Program-- -- Initialize Variables -- local device_id = "MyHomeDevice" local temperature_sensor_id = "MyTemperatureSensor" local temperature_threshold = 75 -- Create Devices -- luup.create_device("OpenLuup Temperature Sensor", 0, device_id, "D_GenericSensor1.xml", "I_GenericSensor1.xml", "S_TemperatureSensor1.xml", "") luup.variable_set("urn:upnp-org:serviceId:TemperatureSensor1", "CurrentTemperature", 0, device_id) -- Start Timer -- luup.call_delay("check_temperature", 10, "", false) --Function to Check Temperature-- function check_temperature() local current_temperature = luup.variable_get(temperature_sensor_id, "CurrentTemperature", 0) --Check Temperature Threshold-- if current_temperature >= temperature_threshold then --Send Alert-- luup.call_action("urn:micasaverde-com:serviceId:HomeAutomationGateway1", "SendTextMessage", {PhoneNumber="1234567890", Message="ALERT! Temperature exceeded threshold!"}, 0) end --Reset Timer-- luup.call_delay("check_temperature", 10, "", false) end

      Me:

      Write an iot program using openLuup.

      It:

      Write an iot program using openLuup. -- openLuup IOT Program -- -- Variables local lampState = false local lampTime = 0 -- Functions function lampTimer() if lampTime > 0 then lampTime = lampTime - 1 if lampTime == 0 then luup.variable_set('urn:upnp-org:serviceId:SwitchPower1', 'Status', 0, lampDeviceID) lampState = false end end end -- Setup luup.call_delay('lampTimer', 60, 0) -- Main Loop while true do -- Check for motion if luup.variable_get('urn:micasaverde-com:serviceId:MotionSensor1', 'Tripped', motionSensorDeviceID) == '1' then if not lampState then luup.variable_set('urn:upnp-org:serviceId:SwitchPower1', 'Status', 1, lampDeviceID) lampState = true -- Set lamp timer to 5 minutes lampTime = 300 end end luup.sleep(1) end

      What??

      luup.sleep(1)

      Not good - looks like I still have some semblance of a job to fulfill.

      Me:

      An iot program called openLuup was written by akbooer. Who is akbooer?

      It: (note: answer redacted and as I understand it, also incorrect re: AltUI):

      akbooer is the pseudonym of the software developer and home automation enthusiast. He is the creator of the openLuup home automation software, which is an open-source version of the Vera home automation system. He is also the creator of the AltUI graphical user interface for openLuup.

      Me:

      Who created of the AltUI graphical user interface for openLuup.

      and

      Me:

      Who created of the AltUI graphical user interface for the home automation system Vera.

      Names two different people - mmmm.

      Regardless very impressive - give it a few more years.

      General Discussion
    • Disabled groups in reactions

      tunnus

      MSR tooltip says that "disabled groups are ignored, as if they did not exist (conditions don't run)".

      Just want to clarify if it's by design that actions beneath disabled groups should run? They do run, but intuitively I was expecting them to be disabled as well.

      Running the latest build under Docker.

      Multi-System Reactor
    • Any interest in a Subcategory for Homebridge?

      parkerc

      Being an iPad/iPhone user, I use Homebridge for a number of things. Although it runs completely independently from my main Vera home set up.

      Is anyone else using Homebridge and if there is enough interest would a subcategory be of use ?

      Software
    For those who registered but didn't received the confirmation email, please send an email to support@smarthome.community with the email you used
    • Profile
    • Following 0
    • Followers 0
    • Topics 40
    • Posts 304
    • Best 18
    • Controversial 0
    • Groups 0

    parkerc

    @parkerc

    26
    Reputation
    96
    Profile views
    304
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    parkerc Unfollow Follow

    Best posts made by parkerc

    • RE: Messaging after VERA decoupling

      I’m a bit old school, I still use Prowl with my Veras - https://www.prowlapp.com/

      Here’s some code examples on how to use it.

      
      function my_escape (s)
          s = string.gsub(s, " ", "+")
          return s
      end
      
      function my_prowl (appl, event, description)
          local prowl_url      = "https://api.prowlapp.com/publicapi/add?apikey="
              .. "put-your-api-code-here"
              .. "&application=" .. my_escape(appl)
              .. "&event="         .. my_escape(event)
              .. "&description=" .. my_escape(description)
              .. "&priority=-1"
              .. "&url=https://www.google.co.uk/"
          luup.inet.wget(prowl_url)
      end
      
      my_prowl ("Vera Home Controller", "Testing code", "this could any description")
      

      Or something all in one..

      
      luup.inet.wget("https://api.prowlapp.com/publicapi/add?apikey=Your-api-key-goes-here&application=Test+Event&event=Armed+Notification&description=The+DSC+alarm+system+has+been+armed&priority=1")
      
      posted in Vera
      parkerc
      parkerc
    • Luup : Report - Last Trip

      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()
      
      
      posted in Code/Snippet library
      parkerc
      parkerc
    • RE: Generic support for vacuums

      Thanks - this is good timing as I’m at the point where I need to replace both the vacuum cleaner and also our lawn mower , and the robot option look very attractive in both areas

      posted in Plugins
      parkerc
      parkerc
    • Luup : Foscam API

      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````
      posted in Code/Snippet library
      parkerc
      parkerc
    • RE: SNMP - Is anyone leveraging info via the Simple Network Management Protocol ?

      Oh, and if I just want to pull one of the items I just specify the iso number with the snmpget command. E.g

      local command = io.popen("ssh -i /etc/dropbear/dropbear_rsa_host_key pi@192.168.102.37 'snmpget -v1 -c public 10.10.10.103 iso.3.6.1.2.1.1.1.0' 2>&1")
      local response = command:read("*a")
      print(response)
      

      which in this case will just return the first one.

      iso.3.6.1.2.1.1.1.0 = STRING: "Eaton 5P 1150"
      
      posted in General Discussion
      parkerc
      parkerc
    • RE: Nuke Vera Script

      Hey @rafale77

      I’m going to have a play with this later, as a comprehensive usb/serial server (https://smarthome.community/topic/209/home-automation-serial-server-raspberry-pi ) is something I’ve been tinkering with for years ! (https://community.getvera.com/t/building-a-ser2net-serial-to-ip-server/173673) - wow has it really been that long .. 2012 !!!

      Once announced and eventually added to Vera, Zigbee has been a capability that I’ve been keen to explore, but due to it’s lack of consistency (compared to z-wave) I’ve not invested much time.

      Although; it is on my HA to-do list, - out of my league, but by opening up the zigbee on Vera, is there the potential to extend its usage with (https://github.com/koenkk/zigbee-herdsman ) and (https://github.com/koenkk/zigbee2mqtt) ?

      posted in Vera
      parkerc
      parkerc
    • RE: Add-on - Aviosys IPPower 9258

      Thanks @toggledbits - it’s all working now !! 🤞🤞🤞

      My last piece is back to my other post around error handling, and how I can present that better to the user, and so for that topic, I;ll revert back to that thread.. - > https://smarthome.community/topic/777/luup-error-handling/9

      posted in Code/Snippet library
      parkerc
      parkerc
    • RE: Discover IR codes for lost remote

      There is a great community/code bank on GitHub.

      GitHub - probonopd/irdb: One of the largest crowd-sourced, manufacturer-independent databases of infrared remote control codes on the web, and aspiring to become the most comprehensive and most...

      GitHub - probonopd/irdb: One of the largest crowd-sourced, manufacturer-independent databases of infrared remote control codes on the web, and aspiring to become the most comprehensive and most...

      One of the largest crowd-sourced, manufacturer-independent databases of infrared remote control codes on the web, and aspiring to become the most comprehensive and most accurate one - GitHub - prob...

      Index of codes is here - https://github.com/probonopd/irdb/blob/master/index

      With their API - http://irdb.tk/api

      And you can retrieve a .csv set for anyone via https://cdn.jsdelivr.net/gh/probonopd/irdb@master/codes/Samsung/TV/7,7.csv

      posted in General Discussion
      parkerc
      parkerc
    • RE: Happy Birthday openLuup!

      Happy Birthday!

      posted in openLuup
      parkerc
      parkerc
    • RE: Lua - multi-part/form submission (Paperless-ngx API)

      Managed to get there in the end, posting here to help others..

      local http = require("socket.http")
      local ltn12 = require("ltn12")
      local mime = require("mime")
      local lfs = require("lfs")
      
      local username = "username,"
      local password = "password"
      
      http.TIMEOUT = 5
      
      local function upload_file ( url, filename, title, correspondent )
          local fileHandle = io.open( filename,"rb")
          local fileContent = fileHandle:read( "*a" )
          fileHandle:close()
      
          local boundary = 'abcd'
      	local cdfd = 'Content-Disposition: form-data; '
      
          local header_b = cdfd.. 'name="document"; filename="' ..filename.. '"\r\nContent-Type: application/pdf'
          local header_c = cdfd.. 'name="title"\r\n\r\n'..title
          local header_d = cdfd.. 'name="correspondent"\r\n\r\n'..correspondent
      
          local MP_b = '--'..boundary..'\r\n'..header_b..'\r\n\r\n'..fileContent..'\r\n'
          local MP_c = '--'..boundary..'\r\n'..header_c..'\r\n'
          local MP_d = '--'..boundary..'\r\n'..header_d..'\r\n'
      
          local MPCombined = MP_b..MP_c..MP_d..'--'..boundary..'--\r\n'
      
          local   response_body = { }
          local   _, code = http.request {
                  url = url ,
                  method = "POST",
                  headers = {    
      						["Authorization"] = "Basic " .. (mime.b64(username ..":" .. password)),
      						["Content-Length"] =  MPCombined:len(),
                              ['Content-Type'] = 'multipart/form-data; boundary=' .. boundary
                               },
                  source = ltn12.source.string(MPCombined) ,
                  sink = ltn12.sink.table(response_body),
                      }
           return code, table.concat(response_body)
      end
      
       -- local rc,content = upload_file ('http://httpbin.org/post', '/mnt/nas/10.pdf' )
       local rc,content = upload_file ('http://192.168.1.134:8777/api/documents/post_document/', '/mnt/nas/10.pdf', 'Companies House', '12')
       print(rc,content)
      
      posted in Code/Snippet library
      parkerc
      parkerc

    Latest posts made by parkerc

    • RE: Console view: - No Live refreshes via :3480/console?page=devices

      Hi @akbooer how can I help you ‘develop’ the console UI ?

      As you mentioned AJAX-Style calls earlier, which openLuup files and associated programming language can I look into ?

      posted in openLuup
      parkerc
      parkerc
    • RE: Console view: - No Live refreshes via :3480/console?page=devices

      Thanks @akbooer , I’ll make those updates..

      For me, the console is a great little compact dashboard, which for sensors provides some nice addional information.

      If I can help/test anything let me know.

      If/when you have time, it’lll be nice if the console could have its own Favicon assigned (http://www.maxi-pedia.com/Favicon+how+to+create) 🙂

      posted in openLuup
      parkerc
      parkerc
    • RE: Console view: - No Live refreshes via :3480/console?page=devices

      That’s great news, many thanks @akbooer (ALTUI never worked properly on my iPad, so It’s nice to know there are options) and I love the simplicity of the console...

      As I’m running the openLuup docker instance (@vwout ) how do I benefit from this recent update, are there specific file I can update ?

      Will console become the default UI now, rather than ALTUI..(how best do we switch)?

      Also not sure if you are aware, but the ‘bypass’ option on the console view appears as a power symbol (example below)..

      CC460096-8646-45C4-A30D-1D399C1A2836.jpeg

      posted in openLuup
      parkerc
      parkerc
    • Console view: - No Live refreshes via :3480/console?page=devices

      Hi @akbooer

      Just bringing this over as suggested..

      I’ve started to use the console view a lot more, mainly for it’s look and simplicity , but I noticed it does not do any live updates compared to ALTUI, you have to do a full browser reload. Is that by design, or is mine not working?

      Also if I want to go strait to the console view, rather than into ALTUI, I recall seeing something abut altering that in the guide by for the life of me I can’t find it. Is it possible to do, if so how would I do that..

      You suggested this was something you were looking at ? Also you said You don't need a "full browser reload", just click on the display menu item to refresh the screen. - what do you mean by `display menu?

      posted in openLuup
      parkerc
      parkerc
    • DisplayLine1 & 2 - Ability to align text?

      Hi

      Just wondering if it’s possible when writing plugins to set if the text shown via DisplayLine1/2 can be left, right or centre aligned ?

      posted in openLuup
      parkerc
      parkerc
    • RE: Lua - multi-part/form submission (Paperless-ngx API)

      Managed to get there in the end, posting here to help others..

      local http = require("socket.http")
      local ltn12 = require("ltn12")
      local mime = require("mime")
      local lfs = require("lfs")
      
      local username = "username,"
      local password = "password"
      
      http.TIMEOUT = 5
      
      local function upload_file ( url, filename, title, correspondent )
          local fileHandle = io.open( filename,"rb")
          local fileContent = fileHandle:read( "*a" )
          fileHandle:close()
      
          local boundary = 'abcd'
      	local cdfd = 'Content-Disposition: form-data; '
      
          local header_b = cdfd.. 'name="document"; filename="' ..filename.. '"\r\nContent-Type: application/pdf'
          local header_c = cdfd.. 'name="title"\r\n\r\n'..title
          local header_d = cdfd.. 'name="correspondent"\r\n\r\n'..correspondent
      
          local MP_b = '--'..boundary..'\r\n'..header_b..'\r\n\r\n'..fileContent..'\r\n'
          local MP_c = '--'..boundary..'\r\n'..header_c..'\r\n'
          local MP_d = '--'..boundary..'\r\n'..header_d..'\r\n'
      
          local MPCombined = MP_b..MP_c..MP_d..'--'..boundary..'--\r\n'
      
          local   response_body = { }
          local   _, code = http.request {
                  url = url ,
                  method = "POST",
                  headers = {    
      						["Authorization"] = "Basic " .. (mime.b64(username ..":" .. password)),
      						["Content-Length"] =  MPCombined:len(),
                              ['Content-Type'] = 'multipart/form-data; boundary=' .. boundary
                               },
                  source = ltn12.source.string(MPCombined) ,
                  sink = ltn12.sink.table(response_body),
                      }
           return code, table.concat(response_body)
      end
      
       -- local rc,content = upload_file ('http://httpbin.org/post', '/mnt/nas/10.pdf' )
       local rc,content = upload_file ('http://192.168.1.134:8777/api/documents/post_document/', '/mnt/nas/10.pdf', 'Companies House', '12')
       print(rc,content)
      
      posted in Code/Snippet library
      parkerc
      parkerc
    • RE: Lua - multi-part/form submission (Paperless-ngx API)

      --

      To provide some additional information, the following Curl command sent to httpbin.org/post..

      local url_open = 'curl -u "username:password" -F "title=Companies House File" -F "correspondent=12" -F "document=@/mnt/nas/10.pdf" http://httpbin.org/post'
      local command = io.popen(url_open)
      local result = command:read("*a")
      print(result)
      

      Returns the following, which looks good…

      {
      "args": {}, 
      "data": "", 
      "files": {
      "document": "data:application/octet-stream;base64,JVBERi0xLjMNJeLjz9MNCjIyNyAwIG9iag08PCANL0xpbmVhcml6ZWQgMSANL08gMjMxIA0vSCBbIDIzNTAgODc5IF<REDACTED>T5dDT4+DXN0YXJ0eHJlZg0xNzMNJSVFT0YN"
      }, 
      "form": {
      "correspondent": "12", 
      "title": "Companies House File"
      }, 
      "headers": {
      "Accept": "*/*", 
      "Authorization": "Basic dXNlcm5hbWU6cGFzc3dvcmQ=", 
      "Content-Length": "66501", 
      "Content-Type": "multipart/form-data; boundary=------------------------1a4c10e40f1ccf8e", 
      "Host": "httpbin.org", 
      "User-Agent": "curl/7.38.0", 
      "X-Amzn-Trace-Id": "Root=1-6360dbdb-6bea68142a74a1762e74ca04"
      }, 
      "json": null, 
      "origin": "82.30.93.28", 
      "url": "http://httpbin.org/post"
      }
      

      Then using the following Lua code to try and achieve the same thing..

      local http = require("socket.http")
      local ltn12 = require("ltn12")
      local mime = require("mime")
      local lfs = require("lfs")
      
      local username = "username"
      local password = "password"
      
      local httpendpoint = 'http://httpbin.org/post'
      local filepath = "/mnt/nas/10.pdf"
      local file = io.open(filepath, "rb")
      local contents = file:read( "*a" )
      
      -- https://stackoverflow.com/questions/3508338/what-is-the-boundary-in-multipart-form-data
      
      local boundary = "-----BoundaryePkpFF7tjBAqx29L"
      local send = "--"..boundary..
                  "\r\nContent-Disposition: form-data; title='Companies House File'\r\n"
      			.."----"..boundary..
      			"\r\nContent-Disposition: form-data; document="..filepath..
                  "\r\nContent-type: application/pdf".."\r\n"
      			..contents.."\r\n"
      			.."------"..boundary.."--\r\n"
      
      -- Execute request (returns response body, response code, response header)
      
      local resp = {}
      local body, code, headers, status = http.request {
          url = httpendpoint,
          method = 'POST',
          headers = {
      		["Authorization"] = "Basic " .. (mime.b64(username ..":" .. password)),
      		["Content-Length"] = lfs.attributes(filepath, 'size'),
      		['Content-Type'] = "multipart/form-data; boundary="..boundary,
          },
         -- source = ltn12.source.file( io.open(filepath,"rb") ),
         source = ltn12.source.file( io.open(send) ),
          sink = ltn12.sink.table(resp)
      }
      
      print(body, code, headers, status)
      print(table.concat(resp))
      
      if headers then 
          for k,v in pairs(headers) do 
              print(k,v) 
          end
      end
      
      

      I get this returned..

      nil     -------BoundaryePkpFF7tjBAqx29L 
      Content-Disposition: form-data; title='Companies House File' 
      ---------BoundaryePkpFF7tjBAqx29L 
      Content-Disposition: form-data; document=/mnt/nas/10.pdf 
      Content-type: application/pdf 
      %PDF-1.3 %âãÏÓ 
      227 0 obj << /Linearized 1 /O 231 /H [ 2350 879 ] /L 66081 /E 19639 /N 4 /T 61422 >> endobj xref 227 57 0000000016 00000 n 
      0000001509 00000 n 
      0000001585 00000 n 
      0000001726 00000 n 
      0000003229 00000 n 
      0000003404 00000 n 
      0000003589 00000 n 
      0000003808 00000 n 
      0000003956 00000 n 
      0000004161 00000 n 
      0000004309 00000 n 
      0000004515 00000 n 
      0000004663 00000 n 
      0000004843 00000 n 
      0000005015 00000 n 
      0000005218 00000 n 
      0000005366 00000 n 
      0000005570 00000 n 
      0000005718 00000 n 
      0000006003 00000 n 
      0000006289 00000 n 
      0000006456 00000 n 
      0000006549 00000 n 
      0000006804 00000 n 
      0000007035 00000 n 
      0000007265 00000 n 
      0000007461 00000 n 
      0000007655 00000 n 
      0000007851 00000 n 
      0000008046 00000 n 
      0000008253 00000 n 
      0000008400 00000 n 
      0000008622 00000 n 
      0000008770 00000 n 
      0000008982 00000 n 
      0000009130 00000 n 
      0000009353 00000 n 
      0000009501 00000 n 
      0000009720 00000 n 
      0000009866 00000 n 
      0000010075 00000 n 
      0000010223 00000 n 
      0000010948 00000 n 
      0000011372 00000 n 
      0000011394 00000 n 
      0000011503 00000 n 
      0000012853 00000 n 
      0000013021 00000 n 
      0000013133 00000 n 
      0000014623 00000 n 
      0000014730 00000 n 
      0000016927 00000 n 
      0000016950 00000 n 
      0000019315 00000 n 
      0000019394 00000 n 
      0000002350 00000 n 
      0000003207 00000 n 
      trailer << /Size 284 /Info 226 0 R /Encrypt 229 0 R /Root 228 0 R /Prev 61411 /ID[] >> startxref 0 %%EOF 228 0 obj << /Type /Catalog /Pages 225 0 R /AcroForm 230 0 R >> endobj 229 0 obj << /Filter /Standard /V 1 /R 2 /O (ÞŒŠþ0á6xƒV\nX¹#'ügã;Èè_Žu®ãªæu_-) /U (Ôeè³~„ˆ¸ÚC»ÒV!Øm: No such file or directory     
      

      It’s clear I’m not getting the content sent in the right format/structure, but I cannot find any guidance that clearly explains how to construct a multi-part form submissions via Lua code..

      Hoping someone can help…

      posted in Code/Snippet library
      parkerc
      parkerc
    • Lua - multi-part/form submission (Paperless-ngx API)

      Hi

      I’ve been investing a lot of time recently trying to digitise everything I can, and my current adventure is with all my paper documents.

      My tool of choice is Paperless-ngx, which so far is an amazing open source solution, and highly recommended if you’re interest in such a thing…

      Such a move to Paperless would not be complete without some form of integration into Vera / openLuup, and thankfully it has a nice Rest API (https://paperless-ngx.readthedocs.io/en/latest/api.html) I can use. So far I’ve been able to make use the GET requests, to provide document counts etc., but it’s the mutipart/form data piece where I’m struggling..

      The Curl command to upload a document, is as follows

      curl -H "Authorization: Basic Y2hyaXM62tgbsgjunotmeY2hyaXNob3N0aW5n" -F "title=Companies House File 10" -F "correspondent=12" -F "document=@/mnt/nas/10.pdf" http://192.168.102.134:8777/api/documents/post_document/
      

      But, I’d like to know how to do this with Lua code, more just to help me in my Lua learning curve, and what I thought would be reasonably straight forward thing to do, has turned out to be quite the opposite 🙂 Sending a multipart form data submission via http.request, is not as straight forward as I hoped. If anyone has any time to help, I’d appreciate some guidance on what I’m missing with the following, as based on the feedback, it looks like it not seeing the file (which I think I’ve confirmed by trying to sending both the curl and Lua commands to httbin.org ) …

      local http = require("socket.http")
      local ltn12 = require("ltn12")
      local mime = require("mime")
      local lfs = require("lfs")
      
      local username = "username"
      local password = "password"
      
      local httpendpoint = 'http://httpbin.org/post'
      local filepath = "/mnt/nas/10.pdf"
      local file = io.open(filepath, "rb")
      local contents = file:read( "*a" )
      
      -- https://stackoverflow.com/questions/3508338/what-is-the-boundary-in-multipart-form-data
      
      local boundary = "-----BoundaryePkpFF7tjBAqx29L"
      local send = "--"..boundary..
                  "\r\nContent-Disposition: form-data; title='Companies House File'\r\n"
      			.."----"..boundary..
      			"\r\nContent-Disposition: form-data; document="..filepath..
                  "\r\nContent-type: application/pdf".."\r\n"
      			..contents.."\r\n"
      			.."------"..boundary.."--\r\n"
      
      -- Execute request (returns response body, response code, response header)
      
      local resp = {}
      local body, code, headers, status = http.request {
          url = httpendpoint,
          method = 'POST',
          headers = {
      		["Authorization"] = "Basic " .. (mime.b64(username ..":" .. password)),
      		["Content-Length"] = lfs.attributes(filepath, 'size'),
      		['Content-Type'] = "multipart/form-data; boundary="..boundary,
          },
         -- source = ltn12.source.file( io.open(filepath,"rb") ),
         source = ltn12.source.file( io.open(send) ),
          sink = ltn12.sink.table(resp)
      }
      
      print(body, code, headers, status)
      print(table.concat(resp))
      
      if headers then 
          for k,v in pairs(headers) do 
              print(k,v) 
          end
      end
      
      posted in Code/Snippet library
      parkerc
      parkerc
    • RE: Generic support for vacuums

      Ok, I decided to dive into Robot Vaccum cleaners , so picked up an 2nd hand Roomba e5 and have also got a Deenkee arriving tomorrow (damn you Amazon and your lightening deals !!!)

      Now, I obviously will want to get them both integrated into my Vera/OpenLuup world at some point, and starting with the Roomba, I’ve been trying to get Rest980 up and running (https://github.com/koalazak/rest980)..

      Is anyone already using this to interface with their Roomba ?
      If not, what are people using with their Roombas?

      posted in Plugins
      parkerc
      parkerc
    • RE: Lua : Downloading a file over https

      Ok, not had much luck with the variations I tried, 😞

      One thing I did notice was that the luasec version on VeraPlus is v0.4 and the openssl version is v1.0.2

      # openssl version
      OpenSSL 1.0.2l  25 May 2017
      

      Checking the luasec guidance here, https://github.com/brunoos/luasec/wiki/LuaSec-1.0.x , that VeraPlus openSSL version supports luasec v 1.0.x ?

      Without being able to install/use Luarocks, any idea how to upgrade from luasec 0.4 to 1.0.x?

      posted in Code/Snippet library
      parkerc
      parkerc