Announcement

Collapse
No announcement yet.

Use the ambient light sensor in the SB radio in HS.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Use the ambient light sensor in the SB radio in HS.

    I noticed there is an ambient light sensor in my SB radio to dim the lcd panel. Is it possible for the plugin to read this sensor and use it in Homeseer?

    Regards,

    Frank

    #2
    No the plugin cannot read it and don't think any information is sent to the SB server that the plugin could use.

    Comment


      #3
      Ok, thanks for your reply..

      Comment


        #4
        Use the Ambient Light Sensor in the SB Radio/Touch in HS3

        Hi all,

        I've created a script to read the ambient light sensor value from a Squeezebox Radio or Touch and then store it in a HS device. The value is accessible by enabling Remote Login (ssh) under Settings - Advanced on the SB Touch/Radio. I then use a utility called plink, which is a command line version of PuTTY, to grab the value. If anyone is interested, I can post more details. The SB Touch reports the value in lux (looks to be 0-400) but the Radio reports a value in the range of 1 to 100,000 with 100,000 being pitch-black and 1 being very bright. These values can then be used to trigger events.

        Cheers
        Al
        HS 4.2.8.0: 2134 Devices 1252 Events
        Z-Wave 3.0.10.0: 133 Nodes on one Z-Net

        Comment


          #5
          Cool!

          Comment


            #6
            Hi all,

            I've found a second (better) way to accomplish this. Rather than polling from the HS3 server for updates, I've created a shell script that runs on the Radio or Touch which will update HS3 through the JSON interface if the ambient light value changes by more than a certain percentage. This way actions can be triggered immediately if there is a large enough ambient light change. Still messing with it but once it's finalized will post the details here.

            Cheers
            Al
            HS 4.2.8.0: 2134 Devices 1252 Events
            Z-Wave 3.0.10.0: 133 Nodes on one Z-Net

            Comment


              #7
              Wow, sparkman. Looking forward for that.
              HSPro 3.0.0.458, Z-NET with Z-wave plugin 3.0.1.190, RFXCOM + 2x RFXtrx433E, HSTouch, Squeezebox plugin, iTach IP/WF2IR & GC-100-6 with UltraGCIR, BLDenon, NetcamStudio, Jon00s Webpage builder, Harmony Hub plugin, SCSIP (with FreePBX), Arduino plugin, IFTTT, Pushalot plugin, Device History plugin.
              Running on Windows 10 (64) virtualized
              on ESXi (Fujitsu Primergy TX150 S8).
              WinSeer (for Win10) - TextSeer - FitbitSeer - HSPI_MoskusSample

              Are you Norwegian (or Scandinavian) and getting started with HomeSeer? Read the "HomeSeer School"!

              Comment


                #8
                Originally posted by pcp View Post
                Cool!
                Originally posted by Moskus View Post
                Wow, sparkman. Looking forward for that.
                Thanks guys, should have something posted by the weekend. Philippe, are you ok if I post it in the SB Plugin section of the forum? I know it's not directly related to the plugin, but it's probably the best place for people interested in it to find it.

                Cheers
                Al
                HS 4.2.8.0: 2134 Devices 1252 Events
                Z-Wave 3.0.10.0: 133 Nodes on one Z-Net

                Comment


                  #9
                  A quick update. I have it running successfully on a number of Radio & Touch devices. The Touch includes a proximity sensor as well and the script will push that data into HS too.

                  I've gone away from using JSON as that does not work with status only devices. I could have turned them into "controllable" devices, but instead created an ASP page that will sit on the HS3 web server and take the values sent to it and populate the HS devices. The other advantage of that is that the ASP page can figure out which SB device the data came from (based on ip address) and populate the appropriate HS device. With the JSON method I would have had to hard code the HS devices on each specific SB player. I will leave it run for a few days to see if any issues crop up and then post the script and ASP page.

                  Cheers
                  Al
                  Last edited by sparkman; January 23, 2015, 08:42 PM.
                  HS 4.2.8.0: 2134 Devices 1252 Events
                  Z-Wave 3.0.10.0: 133 Nodes on one Z-Net

                  Comment


                    #10
                    Originally posted by sparkman View Post
                    Thanks guys, should have something posted by the weekend. Philippe, are you ok if I post it in the SB Plugin section of the forum? I know it's not directly related to the plugin, but it's probably the best place for people interested in it to find it.

                    Cheers
                    Al
                    Thanks for asking and fine for you posting it here. It is a follow up from your earlier request top of the thread.

                    Comment


                      #11
                      Hi all,

                      Attached is a zip file that contains 3 files that will allow you to get ambient light values from SqueezeBox Touch and Radio devices proximity values from SqueezeBox Touch devices into HS3.
                      1. SB Data.pdf - These are the instructions.
                      2. sbdata.sh - This is the script that needs to be installed on your SB Radio or Touch device(s). See the instructions for details.
                      3. sbdata.asp - This is the asp file that needs to be placed in the html folder on your HS3 server. The file needs to be edited for your specific environment. See the instructions for details.


                      Any questions, comments, please post here.

                      Cheers
                      Al

                      Click image for larger version

Name:	SB Data Devices.PNG
Views:	1
Size:	59.6 KB
ID:	1176101


                      PS I also have a script that allows HS to poll the values on a regular basis from a Radio or Touch. It's a bit simpler, but doesn't provide near real time updates.
                      Last edited by sparkman; January 31, 2015, 10:51 PM. Reason: Updated sbdata.sh script and instructions (v3.2) to put ip address on the command line rather than in the script. There's no need to update if you already have it working.
                      HS 4.2.8.0: 2134 Devices 1252 Events
                      Z-Wave 3.0.10.0: 133 Nodes on one Z-Net

                      Comment


                        #12
                        Al,

                        I have been trying to implement your script but I seem not to be able to get the .sh script to work. I have changed the ip addresses to my homeseer server on port 82. As far I could find, I needed to adjust only two lines for that: the lines for defining the variables BASEWEBURL and WEBURLINIT.

                        After the adjustments I transferred the file to the SB Touch and changed the execute settings. After that I ran putty, cd'd to /usr/bin and gave the command sbdata 10 5 -v.

                        the only answer i am getting is "-sh: sbdata.sh: not found", as if the script is not found. if I do a ls -l I see the file indeed in /usr/bin/

                        lrwxrwxrwx 1 root root 17 Jan 1 1970 reset -> ../../bin/busybox
                        lrwxrwxrwx 1 root root 17 Jan 1 1970 rtcwake -> ../../bin/busybox
                        lrwxrwxrwx 1 root root 17 Jan 1 1970 rx -> ../../bin/busybox
                        -rwxr-xr-x 1 root root 6620 Jan 26 21:49 sbdata.sh
                        lrwxrwxrwx 1 root root 23 Jan 1 1970 scp -> /usr/sbin/dropbearmulti
                        -rwxr-xr-x 1 root root 1203 Jan 1 1970 sdl-config
                        lrwxrwxrwx 1 root root 17 Jan 1 1970 seq -> ../../bin/busybox

                        So I am at loss, which is not a surprise because I am not really 'at home' in Linux

                        Any idea how I could proceed from here?

                        Wim
                        -- Wim

                        Plugins: JowiHue, RFXCOM, Sonos4, Jon00's Perfmon and Network monitor, EasyTrigger, Pushover 3P, rnbWeather, BLBackup, AK SmartDevice, Pushover, PHLocation, Zwave, GCalseer, SDJ-Health, Device History, BLGData

                        1210 devices/features ---- 392 events ----- 40 scripts

                        Comment


                          #13
                          Hi Wim,

                          I'm not at home right now so can't check in detail, but maybe try putting it in the /bin directory rather than /usr/bin. Also, what version is your Touch? Try changing the permissions to match the other files in the directory and see if that changes anything.
                          The other thing to try is executing the commands in the sh script manually at the command prompt. It may be failing on one of the commands in the script. I'm not much of a unix guy either, just enough to be dangerous .

                          Cheers
                          Al
                          Last edited by sparkman; January 27, 2015, 10:10 AM.
                          HS 4.2.8.0: 2134 Devices 1252 Events
                          Z-Wave 3.0.10.0: 133 Nodes on one Z-Net

                          Comment


                            #14
                            Al,

                            I did some more tinkering just now. Yesterday I changed the script by adjusting the IP address. But today I remembered that I used Windows notepad for that. Yeah.... and in the past I had issues with notepad and Linux before.
                            So today I placed you script on the SB Touch and used the WinSCP editor to change it. And from there on it starting running correct....

                            So, don't change the sbdata.sh with notepad, an old lesson this old mule just don't seem to learn

                            Now I have everthing running and updates are coming through to HS perfectly!!
                            Lots of thanks for it Al!

                            One last question, if HS is shutdown, the script would not be able to reach HS obviously. Would that stop the script from running? Would I need to reboot the SB Touch for it?

                            Regards,

                            Wim
                            -- Wim

                            Plugins: JowiHue, RFXCOM, Sonos4, Jon00's Perfmon and Network monitor, EasyTrigger, Pushover 3P, rnbWeather, BLBackup, AK SmartDevice, Pushover, PHLocation, Zwave, GCalseer, SDJ-Health, Device History, BLGData

                            1210 devices/features ---- 392 events ----- 40 scripts

                            Comment


                              #15
                              Glad to hear it's working Wim. Re. your last question, I did some limited testing on the weekend with that while I upgraded HS3 from .149 to .152. Once HS was back on-line, the data started updating automatically again, with no need to restart the SB Radio or Touch devices.

                              Cheers
                              Al

                              PS I'll update the instructions to reference copying the file first and then editing with the WinSCP editor.
                              HS 4.2.8.0: 2134 Devices 1252 Events
                              Z-Wave 3.0.10.0: 133 Nodes on one Z-Net

                              Comment

                              Working...
                              X