GithubHelp home page GithubHelp logo

solectrus / shelly-collector Goto Github PK

View Code? Open in Web Editor NEW
1.0 3.0 0.0 222 KB

Collects power consumption from Shelly and transmits it to InfluxDB. Ready for use on a Raspberry Pi.

License: MIT License

Dockerfile 2.49% Ruby 97.51%
influxdb rasperry-pi shelly house-automation

shelly-collector's Introduction

Build Status Maintainability Test Coverage wakatime

SOLECTRUS

Photovoltaic Dashboard, read here about the motivation (in German): https://ledermann.dev/blog/2021/02/03/photovoltaik-dashboard-als-web-applikation/

Screenshot

Live Demo

A live demo with realtime data is available at https://demo.solectrus.de

Installation

For self-hosting SOLECTRUS, please look at https://github.com/solectrus/hosting

Development

  1. Clone the repo locally:
git clone [email protected]:solectrus/solectrus.git
cd solectrus
  1. Install PostgreSQL, Redis, and puma-dev (if not already present). On a Mac with HomeBrew, run this to install from the Brewfile:
brew bundle
  1. Install and set up puma-dev to use HTTPS for development. Do this on macOS:
sudo puma-dev -setup
puma-dev -install
puma-dev link

# Use Vite via puma-dev proxy
# Adopted from https://github.com/puma/puma-dev#webpack-dev-server
echo 3036 > ~/.puma-dev/vite.solectrus
  1. Setup the application to install gems and NPM packages and create the database:
bin/setup
  1. Start the application locally:
bin/dev

This starts the app and opens https://solectrus.test in your default browser (see Procfile.dev).

Test

After preparing development environment (see above):

bin/influxdb-restart.sh
DISABLE_SPRING=1 bin/rspec
DISABLE_SPRING=1 RAILS_ENV=test bin/rake cypress:run
open coverage/index.html

RuboCop:

bin/rubocop

ESLint:

bin/yarn lint

TypeScript:

bin/yarn tsc

There is a shortcut to run all test and linting tools:

bin/test

Performance monitoring

The Live Demo is hosted at Hetzner Cloud. For performance monitoring, it uses RorVsWild, which is free for OpenSource projects. You can see internal metrics like CPU, memory, and disk usage, as well as request times and errors here: https://www.rorvswild.com/applications/136101/requests

License

Copyright (c) 2020-2024 Georg Ledermann, released under the AGPL-3.0 License

shelly-collector's People

Contributors

dependabot[bot] avatar ledermann avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

shelly-collector's Issues

Fehler "uninitialized constant ShellyAdapter::Error"

Die Abfrage des Shellys klappt nicht, das log sagt

shelly-collector-1    | Error getting data from Shelly at http://10.10.13.16: uninitialized constant ShellyAdapter::Error

Die IP stimmt aber auf jeden Fall. Was mir auffällt: die Abfragt geht als http raus, der Shelly antwortet aber auf https. Der Shelly macht aber ja selbst ne redirection nach https, sodass es hier eigentlich kein Problem geben sollte.
Muss ich am Shelly selbst noch etwas einstellen?

Originally posted by @Oggy512 in solectrus/solectrus#3281 (comment)

Support für Shelly 3EM

Ein Shelly 3EM wird derzeitig nicht unterstützt.

API:
https://shelly-api-docs.shelly.cloud/gen1/#shelly-3em-status

Beispiel-Response von /status:

{
   "wifi_sta":{
      "connected":true,
      "ssid":"xxx",
      "ip":"10.10.13.16",
      "rssi":-53
   },
   "cloud":{
      "enabled":false,
      "connected":false
   },
   "mqtt":{
      "connected":false
   },
   "time":"18:51",
   "unixtime":1721580697,
   "serial":3,
   "has_update":false,
   "mac":"3494547B6253",
   "cfg_changed_cnt":0,
   "actions_stats":{
      "skipped":0
   },
   "relays":[
      {
         "ison":false,
         "has_timer":false,
         "timer_started":0,
         "timer_duration":0,
         "timer_remaining":0,
         "overpower":false,
         "is_valid":true,
         "source":"input"
      }
   ],
   "emeters":[
      {
         "power":3.33,
         "pf":0.51,
         "current":0.03,
         "voltage":236.14,
         "is_valid":true,
         "total":148019.6,
         "total_returned":15.3
      },
      {
         "power":0.00,
         "pf":-0.00,
         "current":1.75,
         "voltage":235.59,
         "is_valid":true,
         "total":1744539.0,
         "total_returned":701.9
      },
      {
         "power":66.71,
         "pf":0.64,
         "current":0.45,
         "voltage":234.70,
         "is_valid":true,
         "total":1174011.1,
         "total_returned":0.0
      }
   ],
   "total_power":70.04,
   "emeter_n":{
      "current":0.00,
      "ixsum":1.57,
      "mismatch":false,
      "is_valid":false
   },
   "fs_mounted":true,
   "v_data":1,
   "ct_calst":0,
   "update":{
      "status":"idle",
      "has_update":false,
      "new_version":"20230913-114244/v1.14.0-gcb84623",
      "old_version":"20230913-114244/v1.14.0-gcb84623",
      "beta_version":"20231107-165007/v1.14.1-rc1-g0617c15"
   },
   "ram_total":49920,
   "ram_free":31208,
   "fs_size":233681,
   "fs_free":154616,
   "uptime":697
}

Shelly collector blieb einfach stehen

Guten morgen,

ich hatte mich heute morgen gewundert, dasss keine Daten für die Wärmepumpe vorlagen. Im Portainer habe ich dann gesehen, dass der Container für den Shelly Collector (und nur der) im Status Stopped war. Er lies sich dann direkt wieder starten und die Daten lagen dann auch direkt wieder vor.

Im Log fand sich leider kein Hinweis warum der Collector stehen geblieben ist:

Successfully pushed record #48830 to InfluxDB
Got record #48831 at 2024-03-13 17:22:52 +0000 within 35 ms, Power 27.168 W, Temperature 41.5 °C
Successfully pushed record #48831 to InfluxDB
Shelly collector for SOLECTRUS, Version 0.1.1, built at 2024-03-02T05:46:25.969Z
https://github.com/solectrus/shelly-collector
Copyright (c) 2024 Georg Ledermann, released under the MIT License
Using Ruby 3.3.0 on platform aarch64-linux-musl
Pushing to InfluxDB at http://influxdb:8086, bucket my-solectrus-bucket, measurement SENEC
Pulling from your Shelly at http://192.168.2.201 every 5 seconds
Got record #1 at 2024-03-14 07:37:11 +0000 within 83 ms, Power 9.522 W, Temperature 41.2 °C
Successfully pushed record #1 to InfluxDB

Ich beobachte es mal und berichte, ob es nochmal auftritt.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.