piBeacon: presence monitoring plugin discussions

Posted on
Sun Jul 26, 2020 4:09 pm
kw123 offline
User avatar
Posts: 7134
Joined: May 12, 2013
Location: Dallas, TX

Re: piBeacon: presence monitoring plugin discussions

Looks all
Ok will do 2 more copies to simulate.

And by the way you have a temperature or under Voltage issue on your rpi.
Look at your power supply.

Karl.


Sent from my iPhone using Tapatalk

Posted on
Sun Jul 26, 2020 4:10 pm
kw123 offline
User avatar
Posts: 7134
Joined: May 12, 2013
Location: Dallas, TX

Re: piBeacon: presence monitoring plugin discussions

And try to delete that device and recreate it.


Sent from my iPhone using Tapatalk

Posted on
Sun Jul 26, 2020 4:57 pm
GlennNZ offline
Posts: 752
Joined: Dec 07, 2014
Location: Central Coast, Australia

Re: piBeacon: presence monitoring plugin discussions

HI Karl

Think it has to do with the blank ipAddress?

This rpi has a USB wifi connector (to use big antenna) as far away.
Occasionally gets 2 ip address 192.168.1.185 and on from the unwanted wlan1 adpater 192.168.1.42
Typically I disable that wlan1 with sudo ifconfig wlan1 down, and all ticks over until reboot.

ifconfig
Code: Select all
eth0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether b8:27:eb:c4:3e:e3  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 619  bytes 149512 (146.0 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 619  bytes 149512 (146.0 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.185  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::f185:3dda:a1eb:bfde  prefixlen 64  scopeid 0x20<link>
        ether e8:4e:06:0c:32:39  txqueuelen 1000  (Ethernet)
        RX packets 14125  bytes 2572946 (2.4 MiB)
        RX errors 0  dropped 133  overruns 0  frame 0
        TX packets 2154  bytes 350569 (342.3 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0


But now getting (after resend all files) no ip address?

Code: Select all
27-08:53:25 piBeaconUtils   writeTZ              L:1333 Lv:30 cBY:master               changing timezone executing
27-08:53:26 piBeaconUtils   writeIPtoFile        L:1627 Lv:30 cBY:master               writing ip number to file >><<  reason:
27-08:53:31 master          checknetwork0        L:1621 Lv:30 no ip number working, trying again, indigoServerOn:True, ip:
27-08:53:39 master          checknetwork0        L:1621 Lv:30 no ip number working, trying again, indigoServerOn:True, ip:
27-08:53:46 master          checknetwork0        L:1621 Lv:30 no ip number working, trying again, indigoServerOn:True, ip:
27-08:53:53 master          checknetwork0        L:1621 Lv:30 no ip number working, trying again, indigoServerOn:True, ip:
27-08:53:53 master          checknetwork0        L:1613 Lv:30 no ip number working, giving up, running w/o ip number, setting mode to clockMANUAL
27-08:53:55 piBeaconUtils   writeTZ              L:1333 Lv:30 cBY:master               changing timezone executing
27-08:53:55 master          readNewParams        L:382  Lv:30 UPS-V2 interface NOT enabled
27-08:54:02 piBeaconUtils   writeTZ              L:1333 Lv:30 cBY:ADS1x15              changing timezone executing
27-08:54:02 ADS1x15         readParams           L:611  Lv:30 ==== Start ADS1x15 ===== @ i2c:73; inputC:0;  deltaX:0.1, gain:6144, resModel:1
27-08:54:02 ADS1x15         readParams           L:611  Lv:30 ==== Start ADS1x15 ===== @ i2c:73; inputC:0;  deltaX:0.1, gain:6144, resModel:1
27-08:54:02 ADS1x15         readParams           L:611  Lv:30 ==== Start ADS1x15 ===== @ i2c:73; inputC:0;  deltaX:0.1, gain:6144, resModel:1
27-08:54:02 ADS1x15         readParams           L:611  Lv:30 ==== Start ADS1x15 ===== @ i2c:73; inputC:0;  deltaX:0.1, gain:6144, resModel:1
27-08:54:02 ADS1x15         readParams           L:613  Lv:30 ==== Start ADS1x15... sendToIndigoEvery:60.0;minSendDelta:4.0;  sensorRefreshSecs:10.0,all i2c->devids:{73: [u'297270947', u'1036561108', u'1021059064', u'752082303']}
27-08:54:02 piBeaconUtils   getIPNumber          L:640  Lv:30 cBY:ADS1x15              no ip number defined
27-08:54:02 ADS1x15         execADS1x15          L:679  Lv:30 no ip number working, giving u



-----------------------
Ipaddress seems to be False Alarm - Sorry
----------------------
Resend everything and reboot seems to have resolved the ipAddress
The status still is recording 'bad Sensor data, disconnected'

That rpi is on a long long power cable above a water tank in waterproof box.
No surprising is undervolt; haven't got around to upgrading the gauge of cable...

Posted on
Sun Jul 26, 2020 5:05 pm
kw123 offline
User avatar
Posts: 7134
Joined: May 12, 2013
Location: Dallas, TX

Re: piBeacon: presence monitoring plugin discussions

It can only show "bad Sensor data, disconnected?"
when the RPI sends that to the plugin
Code: Select all
               if u"badSensor" in uData:
                  self.addToStatesUpdateDict(dev.id,u"status",u"bad Sensor data, disconnected?")

and the rpi sends that when
Code: Select all
               if value == "":
                  sensorWasBad = True
                  data["sensors"][sensor][devId]["INPUT"] = "badSensor"
                  if badSensor > 5:
                     U.logger.log(30," bad sensor")
                     U.sendURL(data)
                  lastData[devId] =-100.
                  continue

and value =="" when there is a read error
you should see that with:
tail -f /var/log/pibeacon.log
on the RPI

And could you post the file parameters from the RPI /home/pi/pibeacon/parameters
the section :
Code: Select all
 "sensors": {
    "ADS1x15": {
      "1697729290": {
        "format": "%3.2f",
        "gain": "6144",
        "i2cAddress": "72",
        "input": "0",
        "logScale": "0",
        "minSendDelta": "4",
        "offset": "-370",
        "resModel": "16",
        "sendToIndigoEvery": "30",
        "sensorRefreshSecs": "2",
        "useMuxChannel": "-1"
      },
      "188809276": {
        "format": "%3.0f",
        "gain": "6144",
        "i2cAddress": "72",
        "input": "0",
        "logScale": "0",
        "minSendDelta": "4",
        "offset": "-370",
        "resModel": "16",
        "sendToIndigoEvery": "30",
        "sensorRefreshSecs": "2",
        "useMuxChannel": "-1"
      }
    },
....


and here w 4 identical devices for the same input port
Screen Shot 2020-07-26 at 18.02.51.png
Screen Shot 2020-07-26 at 18.02.51.png (68.25 KiB) Viewed 156 times


Karl

Posted on
Sun Jul 26, 2020 5:12 pm
GlennNZ offline
Posts: 752
Joined: Dec 07, 2014
Location: Central Coast, Australia

Re: piBeacon: presence monitoring plugin discussions

Yeah - saw that in the plugin.py.

I do have a couple (well plenty) of sensors on other rpis that are actually disconnected/bad Sensor.
How well isolated to this sensor/pi is that error message?
(Strangely INPUT, INPut_raw all fine....)

parameters: (Copied and paste in 2 halfs ignore any {} formatting issues)
Code: Select all
"sensors": {
    "ADS1x15": {
      "1021059064": {
        "gain": "6144",
        "i2cAddress": "73",
        "input": "0",
        "logScale": "0",
        "minSendDelta": "4",
        "offset": "0",
        "resModel": "16",
        "sendToIndigoEvery": "60",
        "sensorRefreshSecs": "1"
      },
      "1036561108": {
        "gain": "6144",
        "i2cAddress": "73",
        "input": "0",
        "logScale": "0",
        "minSendDelta": "10",
        "offset": "-370",
        "resModel": "16",
        "sendToIndigoEvery": "180",
        "sensorRefreshSecs": "10",
        "useMuxChannel": "-1"
      },
      "297270947": {
        "format": "%3.0f",
        "gain": "6144",
        "i2cAddress": "73",
        "input": "0",
        "logScale": "0",
        "minSendDelta": "10",
        "offset": "-370",
        "resModel": "16",
        "sendToIndigoEvery": "180",
        "sensorRefreshSecs": "10",
        "useMuxChannel": "-1"
      },
      "752082303": {
        "gain": "6144",
        "i2cAddress": "73",
        "input": "0",
        "logScale": "0",
        "minSendDelta": "4",
        "offset": "0",
        "resModel": "16",
        "sendToIndigoEvery": "60",
        "sensorRefreshSecs": "10",
        "useMuxChannel": "-1"
      }
    }


Just noticed that 1021059064 - doesn't have useMuxChannel - have opened and edited slightly to hopefully update.
Doesn't seem to have updated at rpi level - will do so manually in Nano, no difference
Last edited by GlennNZ on Sun Jul 26, 2020 5:19 pm, edited 2 times in total.

Posted on
Sun Jul 26, 2020 5:13 pm
kw123 offline
User avatar
Posts: 7134
Joined: May 12, 2013
Location: Dallas, TX

Re: piBeacon: presence monitoring plugin discussions

and for the undervolt issue:

Even if you don't use ethernet connection (ie wifi) use an ethernet cable w POE injector and poe splitter to feed the RPi.
You don't have to use the ethernet function.
That has the advantage that it sends 50Volts (1/10 of the amps needed) and then converts its back to 5V AT THE PLACE OF THE RPI.

eg:
https://www.amazon.com/GAF-USB-802-3af-Splitter-Compatible-Tablets/dp/B019BLMWY0/ref=sr_1_1?dchild=1&keywords=POE+injector+5V+usb&qid=1595805182&sr=8-1
andhttps://www.amazon.com/Injector-Adapter-1000Mbps-802-3af-Compliant/dp/B07V24C4M8/ref=sr_1_9?dchild=1&keywords=POE+injector+5V&qid=1595805066&sr=8-9

Karl

Posted on
Sun Jul 26, 2020 5:20 pm
kw123 offline
User avatar
Posts: 7134
Joined: May 12, 2013
Location: Dallas, TX

Re: piBeacon: presence monitoring plugin discussions

the parameters file looks good.

>>How well isolated to this sensor/pi is that error message?<<

here the code in the plugin:
Code: Select all
for devIds in sensors[sensor]:
   try:   devId = int(devIds)
   except: devId = 0
   if devId == 0: continue
   dev= indigo.devices[devId]
   props= dev.pluginProps
   data = sensors[sensor][devIds]
   uData = unicode(data)

..
   if u"badSensor" in uData:
      self.addToStatesUpdateDict(dev.id,u"status",u"bad Sensor data, disconnected?")
      try: dev.updateStateImageOnServer(indigo.kStateImageSel.PowerOff)
      except: pass
      continue

the "badSensor" text must be in sensors[sensor][devid]

Posted on
Sun Jul 26, 2020 5:26 pm
kw123 offline
User avatar
Posts: 7134
Joined: May 12, 2013
Location: Dallas, TX

Re: piBeacon: presence monitoring plugin discussions

>>Just noticed that 1021059064 - doesn't have useMuxChannel - have opened and edited slightly to hopefully update.

That devices is not using the mux channels, it is ignored, not used if it is there or not, BUT it should be consistent, either the key is there or not, will check

w four independent inputs and four i2c options ( = 16 adc channels) that should be enough

Karl

===> check
tail -f /var/log/pibeacon
!!!

Posted on
Sun Jul 26, 2020 5:48 pm
GlennNZ offline
Posts: 752
Joined: Dec 07, 2014
Location: Central Coast, Australia

Re: piBeacon: presence monitoring plugin discussions

Hi

Added :

Code: Select all
               if u"badSensor" in uData:
                  self.indiLOG.log(10, sensor+" Glenn Added Udata: "+ unicode(uData))
                  self.addToStatesUpdateDict(dev.id,u"status",u"bad Sensor data, disconnected?")
                  try: dev.updateStateImageOnServer(indigo.kStateImageSel.PowerOff)
                  except: pass
                  continue


Oddly - getting nothing at all in plugin.log, where is it coming from....

G

Posted on
Sun Jul 26, 2020 6:03 pm
GlennNZ offline
Posts: 752
Joined: Dec 07, 2014
Location: Central Coast, Australia

Re: piBeacon: presence monitoring plugin discussions

I think the bad Sensor data == message is very old, and that the status of the ADS1x15 device is not being updated....

Glenn

Posted on
Sun Jul 26, 2020 6:40 pm
kw123 offline
User avatar
Posts: 7134
Joined: May 12, 2013
Location: Dallas, TX

Re: piBeacon: presence monitoring plugin discussions

GlennNZ wrote:
I think the bad Sensor data == message is very old, and that the status of the ADS1x15 device is not being updated....

Glenn
Then it has may be the wrong i2c channel
Please check the device id. Make sure
- it is active ( comm on )
- the id is part of the parameters file.

I tried also to add one with the wrong i2c and then yes it shows bad sensor. But only for that one

Also when you have consistent under voltage status you will damage the ssd

Karl


Sent from my iPhone using Tapatalk

Posted on
Sun Jul 26, 2020 7:01 pm
GlennNZ offline
Posts: 752
Joined: Dec 07, 2014
Location: Central Coast, Australia

piBeacon: presence monitoring plugin discussions

Thanks will try ASAP

But are you remembering that all the other states INPUT etc INPUT_raw all correct and updating regularly .....

Seems something specific to the “status” state of the ADS device, but not the others

Glenn


Sent from my iPhone using Tapatalk

Posted on
Sun Jul 26, 2020 7:30 pm
GlennNZ offline
Posts: 752
Joined: Dec 07, 2014
Location: Central Coast, Australia

Re: piBeacon: presence monitoring plugin discussions

OK i2c correct, in edit and parameters file i2cdetect -y 1 - detects
& INPUT updated every 20 seconds or so

plugin.py line 13063:
added Log
Code: Select all
if sensor == u"ADS1x15" :
                  self.indiLOG.log(10, u'Glenn added : devid:' +unicode(dev.id)+", data: "+ unicode(data)+ ', whichkeys:'+unicode(whichKeysToDisplay)+ u', sensor:'+unicode(sensor))
                  self.updateINPUT(dev, data, whichKeysToDisplay, 0, sensor)
                  continue

Code: Select all
2020-07-27 11:25:31 Glenn added : devid:1874635667, data: {u'INPUT': 1051.31}, whichkeys:INPUT_1, sensor:ADS1x15
2020-07-27 11:25:31 Glenn added : devid:1980283685, data: {u'INPUT': 1427.38}, whichkeys:INPUT_0, sensor:ADS1x15
2020-07-27 11:25:31 Glenn added : devid:1874635667, data: {u'INPUT': 1050.75}, whichkeys:INPUT_1, sensor:ADS1x15
2020-07-27 11:25:31 Glenn added : devid:1980283685, data: {u'INPUT': 1417.5}, whichkeys:INPUT_0, sensor:ADS1x15
2020-07-27 11:25:51 Glenn added : devid:93013512, data: {u'INPUT': 553.31}, whichkeys:INPUT, sensor:ADS1x15
2020-07-27 11:25:51 Glenn added : devid:1123032143, data: {u'INPUT': 552.56}, whichkeys:INPUT, sensor:ADS1x15
2020-07-27 11:26:32 Glenn added : devid:1874635667, data: {u'INPUT': 1050.38}, whichkeys:INPUT_1, sensor:ADS1x15
2020-07-27 11:26:32 Glenn added : devid:1980283685, data: {u'INPUT': 1419.63}, whichkeys:INPUT_0, sensor:ADS1x15
2020-07-27 11:26:38 Glenn added : devid:297270947, data: {u'INPUT': 958.88}, whichkeys:INPUT_0, sensor:ADS1x15
2020-07-27 11:26:38 Glenn added : devid:1036561108, data: {u'INPUT': 959.25}, whichkeys:INPUT_0, sensor:ADS1x15
2020-07-27 11:26:38 Glenn added : devid:1021059064, data: {u'INPUT': 959.44}, whichkeys:INPUT, sensor:ADS1x15
2020-07-27 11:26:38 Glenn added : devid:752082303, data: {u'INPUT': 959.44}, whichkeys:INPUT_0, sensor:ADS1x15
2020-07-27 11:27:03 Glenn added : devid:93013512, data: {u'INPUT': 524.25}, whichkeys:INPUT, sensor:ADS1x15
2020-07-27 11:27:03 Glenn added : devid:1123032143, data: {u'INPUT': 522.94}, whichkeys:INPUT, sensor:ADS1x15


1036561108 == status bad sensor, but seems never updated
297270947 == status bad sensor, but seems never updated
1021059064 == Status uptodate & correct

They all have INPUT_O selected - correct one showing key INPUT rest ?INPUT_0,,,,

Posted on
Sun Jul 26, 2020 7:35 pm
kw123 offline
User avatar
Posts: 7134
Joined: May 12, 2013
Location: Dallas, TX

Re: piBeacon: presence monitoring plugin discussions

Ok delete and recreate the devices.

Changed from input_x to just input as each device now has just one channel.
Was done some release ago.


Sent from my iPhone using Tapatalk

Posted on
Sun Jul 26, 2020 7:53 pm
GlennNZ offline
Posts: 752
Joined: Dec 07, 2014
Location: Central Coast, Australia

Re: piBeacon: presence monitoring plugin discussions

OK
Mystery explained - might leave the devices as some are quite well used in triggers/scripts/control pages.. (and INPUT fine)
Thanks again - sorry Karl that was a bit of a wild goose chase..

Who is online

Users browsing this forum: No registered users and 0 guests