mihai-dinculescu / tapo

Unofficial Tapo API Client. Works with TP-Link Tapo smart devices. Tested with light bulbs (L510, L520, L530, L610, L630), light strips (L900, L920, L930), plugs (P100, P105, P110, P115, P300), hubs (H100), switches (S200B) and sensors (KE100, T100, T110, T300, T310, T315).
MIT License
352 stars 36 forks source link

Using as logstash producer #89

Closed nine-2-five closed 11 months ago

nine-2-five commented 1 year ago

Hi,

I made some changes (mainly added a loop) to Mihai's code and dockerized it, but after a period of time the output to console stops while the process is still running, the docker container still exists.

Can anyone more knowledgeable in Rust take a look at this loop and see what's wrong with it?

https://github.com/nine-2-five/tapo-logstash-source/blob/master/examples/tapo_p110.rs

mihai-dinculescu commented 1 year ago

There isn't anything wrong with the code. I would have suspected that the Tapo session expires after a fashion, but that should give errors.

Can you tell after how long it stops outputting?

Also, this filters out any output not coming from a component (your executable or one of its libraries) that doesn't contain tapo in its name. Your executable's info message won't appear if it's called logtash. You might want to change or remove the filter.

    pretty_env_logger::formatted_timed_builder()
        .filter(Some("tapo"), log_level)
        .init();