lux4rd0 / sense-collector

Sense Collector provides a way of collecting real-time data from the Sense Energy Monitor. Includes Grafana dashboards for visualizations of detected devices and smart plugs and their wattage, voltage, and amp utilization.
https://labs.lux4rd0.com/sense-collector/
GNU Affero General Public License v3.0
25 stars 4 forks source link

sleep: invalid option -- '1' #10

Closed everydaylearner closed 2 weeks ago

everydaylearner commented 11 months ago

Anyone getting the following error:

sleep: invalid option -- '1'

Constantly keeps showing up in the logs!

Thank you!

CodaBool commented 11 months ago

Not sure what your use case is but I just ended up switching to the Python unofficial API since all I really want was the usage and solar production over each day.

here is what my resulting python code. I have it run every minute and write to a database. Full code

from sense_energy import Senseable
from dotenv import load_dotenv
import os

load_dotenv()
sense = Senseable()
sense.authenticate("secret@gmail.com", os.environ.get("PASSWORD"))
sense.update_realtime()
print ("usage", int(sense.active_power), "W")
print ("solar", int(sense.active_solar_power), "W")
everydaylearner commented 11 months ago

ohh i see!!! it looks like you are writing to Mongo db not influx. do you have any samples to write to influxdb2 by any chance? :)

CodaBool commented 11 months ago

I unfortunately don't because I've never worked with influx.

Part of the reason I moved to the unofficial API. Because it was db agnostic

CodaBool commented 11 months ago

Chatgpt would probably be happy to write that for you lol

Chat.openai.com

lux4rd0 commented 2 weeks ago

Sleep error was an annoying side effect of the old code. Sorry about that mess!! The new version is rewritten! Hope you can try it out!