-
Notifications
You must be signed in to change notification settings - Fork 163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
--count N does not supported with ATC ? #62
Comments
Hi mkontta, sorry count isn't supported right with atc-mode. Count was introduced to disconnect again from the sensor to save batterie. In ATC mode battery usage is the same, whether the script is running or not. I see you use a list of sensors you want to monitor/report to callback. So how should Since ATC mode receives multiple sensors at the same time and there is no disadvantage in keeping the script running and it is hard to decide how a count option should behave there was from my side of view no need for a count option. If you want to use it send multiple sensors to domoticz, please also have a look at there #59 |
Hi, Thank you for your answer. I understand what you mean. In my case count could be e.g. 8 for 4 sensor. It is not so important if some sensor can not send data to Domoticz during period. My idea was that script would execute with cron with selected interval and after that script could exit. BR, Markku |
How often would you run the script via cron? |
Interval would be like 10min, 30min or 1 hour. |
10 minute interval could be easily achieved when you set advertising interval to 10 minutes in Telinkflasher. Script only reports data to callback when ATC firmware has updated it (done via package counter). And then you have exactly that value. For your intended use case 8 packets for 4 sensor would mean you have to wait two advertising periods of the sensors and with that you have two reported values to domoticz. If you still need longer intervals you could create a bash script which runs the script and sends a kill command lets say after 30 seconds. I would assist you if needed. |
I will test this TelinkFlasher 10min option. Thanks for your support. |
This is another advertising interval. Despite setting advertising interval to 10 seconds, still about every seconds is a BLE packet send. |
Here you go. Probably not perfect but it seems to be working for me the two times I tested it. 554 elif args.passive:
[snip help and imports]
572 cnt=0 ####################
573 advCounter=dict()
574 #encryptedPacketStore=dict()
575 sensors = dict()
576 if args.devicelistfile: 718 def le_advertise_packet_handler(mac, adv_type, data, rssi):
719 global cnt ###################
720 global lastBLEPacketReceived 751 print ("RSSI:", rssi, "dBm")
752 print ("Battery:", measurement.battery,"%")
753 print ("Count:", cnt)
754
##################
755 if args.count is not None and cnt >= args.count:
756 print(str(args.count) + " measurements collected. Exiting in a moment.")
757 os._exit(0)
758 cnt += 1
##################
759
760 currentMQTTTopic = MQTTTopic
761 if mac in sensors:
|
Hi,
I have case where:
Problem is that script does not exit after 2 sending. Any idea what is wrong?
Or do I have undertood "--count" option wrongly?
Used command and log below.
BR, Markku
The text was updated successfully, but these errors were encountered: