utilities/tp-link-to-influxdb#4: Support for a persistent container



Issue Information

Issue Type: issue
Status: closed
Reported By: btasker
Assigned To: btasker

Milestone: v0.24
Created: 18-May-23 18:11



Description

The docker container was designed to be ephemeral, being periodicly fired by cron.

However, this apparently doesn't play well with Synology NAS's which complain that the container exited.

Should add a mode which uses an internal ticker to poll periodically



Toggle State Changes

Activity


assigned to @btasker

Although I'd have preferred it to be a commandline flag (so it's obvious why a cron job isn't exiting) that's likely to be less compatible with things like Synology.

So, I think this needs to be an option in the config file.

Currently, example config looks like this

# List tapo devices
tapo:
    # Tapo devices require that you log in with the credentials
    # that you use to log into the app
    #
    user: "me@mymail.com"
    passw: "mysecretpass"
    devices:
        - 
            name: "washing-machine"
            ip : 192.168.3.152

        - 
            name: "big-fridge"
            ip : 192.168.3.153

# List kasa devices
kasa:
    devices:
        - 
            name: "desk-plug"
            ip: 192.168.3.150

        - 
            name: "tumble-dryer"
            ip : 192.168.3.151


# InfluxDB outputs
influxdb:
    -
        name: "Cloud"
        url: "https://foo.example.com"
        token: "aaabbbccc=="
        org: "my org"
        bucket: "telegraf"

I think the best way to go at this is add a dedicated poller section to contain config for the poller itself, with backwards compatible defaults used so that any existing configs still work after the change

Have added support for a persistent run-mode.

The necessary config is

poller:
    # If true, run in an infinite loop
    persist: true
    # Interval in seconds between runs
    interval: 20

mentioned in issue #6

verified

mentioned in commit github-mirror/tplink_to_influxdb@4a3040fd096ec016f6d8a77f7ce794fd5d372144

Commit: github-mirror/tplink_to_influxdb@4a3040fd096ec016f6d8a77f7ce794fd5d372144 
Author: B Tasker                            
                            
Date: 2023-05-20T23:15:56.000+01:00 

Message +14 -3 (17 lines changed)
verified

mentioned in commit github-mirror/tplink_to_influxdb@78c5703c8868545174071bd34d61a2a29b49dcfb

Commit: github-mirror/tplink_to_influxdb@78c5703c8868545174071bd34d61a2a29b49dcfb 
Author: B Tasker                            
                            
Date: 2023-05-20T23:11:36.000+01:00 

Message

Update example yaml for utilities/tp-link-to-influxdb#4

+7 -0 (7 lines changed)
verified

mentioned in commit github-mirror/tplink_to_influxdb@5534ba7fb200d1bc8f79187fe193a44835be78ad

Commit: github-mirror/tplink_to_influxdb@5534ba7fb200d1bc8f79187fe193a44835be78ad 
Author: B Tasker                            
                            
Date: 2023-05-20T23:04:31.000+01:00 

Message

Break main flow out to new function do_work in preparation for utilities/tp-link-to-influxdb#4

+9 -1 (10 lines changed)
verified

mentioned in commit github-mirror/tplink_to_influxdb@00f29dd0c169f2aa52df16b7cf2877cd082ce018

Commit: github-mirror/tplink_to_influxdb@00f29dd0c169f2aa52df16b7cf2877cd082ce018 
Author: B Tasker                            
                            
Date: 2023-05-20T23:09:46.000+01:00 

Message

Add support for persistent run-mode (utilities/tp-link-to-influxdb#4)

This adds support for new config options in the yaml config

poller:
   # If true, run in an infinite loop
   persist: true
   # Interval in seconds between runs
   interval: 20
+18 -2 (20 lines changed)