Code Monkey home page Code Monkey logo

server's Introduction

MyController

lint workflow publish container images publish executables

MyController is a flexible automation and sensor controller for IoT devices. Whether in the home, at work, or wherever you need it, MyController provides the solution!

  • Privacy focused - Working locally and not in the cloud means your data stays safely with you.
  • Lightweight - runs on multiple architecture (Windows, Linux, etc.,) including Raspberry Pi Zero, 1, 2, 3 and 4. Can run in 50MB of memory and 100MB of disk.

Demo

Documentation

Download

Container images

main branch images are tagged as :2.x.x-devel

Executables

server's People

Contributors

dependabot[bot] avatar jkandasa avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

server's Issues

nill pointer exception in tasmota gateway

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x2c pc=0x946aa0]

goroutine 118 [running]:
github.com/mycontroller-org/server/v2/plugin/gateway/provider/tasmota.(*Provider).ProcessReceived.func1(...)
	/app/plugin/gateway/provider/tasmota/msg_parser.go:92
github.com/mycontroller-org/server/v2/plugin/gateway/provider/tasmota.(*Provider).ProcessReceived(0x3ba36e0, 0x447a0c0)
	/app/plugin/gateway/provider/tasmota/msg_parser.go:228 +0xdc8
github.com/mycontroller-org/server/v2/plugin/gateway/provider.(*Service).rawMessageProcessor(0x3999380, {0xc57b68, 0x447a0c0})
	/app/plugin/gateway/provider/service.go:193 +0x174
github.com/jaegertracing/jaeger/pkg/queue.ConsumerFunc.Consume(0x3cfa920, {0xc57b68, 0x447a0c0})
	/go/pkg/mod/github.com/jaegertracing/[email protected]/pkg/queue/bounded_queue.go:104 +0x2c
github.com/jaegertracing/jaeger/pkg/queue.(*BoundedQueue).StartConsumersWithFactory.func1(0x3cf2e30, 0x3d990b0)
	/go/pkg/mod/github.com/jaegertracing/[email protected]/pkg/queue/bounded_queue.go:83 +0xd4
created by github.com/jaegertracing/jaeger/pkg/queue.(*BoundedQueue).StartConsumersWithFactory
	/go/pkg/mod/github.com/jaegertracing/[email protected]/pkg/queue/bounded_queue.go:73 +0xb0

issues in MySensors Plugin

Reported by: @j54n1n

Source: https://forum.mycontroller.org/topic/492/mycontroller-2-0-is-ready-for-testing/9

Hello @jkandasa,

In the meantime I did some test runs with the weather station and i did notice some things.

  1. The forecast field is missing its text value and it is showing always 0 instead, like so:
    image
    I think it is related to how you map the MySensors field data types. Here at plugin/gateway/provider/mysensors_v2/constant.go you map it as a float type, but according to the MySensors Protocol 2.x documentation it should be a string of either "stable", "sunny", "cloudy", "unstable", "thunderstorm" or "unknown". Your old v1 controller seems to intercept that correctly and shows for example the sun or the cloud symbol. Do you intent that to do the same also in your new v2?

  2. Regarding the data types it seems when the type none is mapped a string can be displayed for a field. For example this is the case for your old v1 style RSSI indicator message:
    image
    So maybe the first point can be partly resolved by changing the type. Furthermore do you intent also reuse your old style RSSI message to let it show at the node status page? Or do you want to support either the MySensors I_SIGNAL_REPORT_REQUEST feature or the NodeManagers signal sensor to show its value at the node status page? In my case the later solution would fit the best because our node is sleeping most of the time without smart sleep to conserve power.

  3. Currently the internal message for the battery percentage is not showing up anywhere. Also there your old v1 controller would show the percentage on the node status page. The MySensors implementation is similar as the NodeManagers SensorSignal solution but it is using an internal message type.

So I think that was everything for now. I am curious what you are thinking about it.
Thanks in advance and kind regards.

server is not running on disconnected environment

error:

2022-08-16T12:12:29.747+0100    info    logger/load.go:15       welcome to the MyController world :)
2022-08-16T12:12:29.748+0100    info    mcbus/client.go:48      bus service paused
2022-08-16T12:12:29.749+0100    info    backup/restore.go:149   Executing import job    {"sourceDir": "/mc_home/data/storage/memory_db/yaml", "fileType": "yaml"}
2022-08-16T12:12:29.749+0100    info    mcbus/client.go:54      bus service resumed
2022-08-16T12:12:29.750+0100    info    server/startup_extra.go:64      error on fetching system settings, assuming it is fresh install and populating default details. if not, report this issue       {"error": "no documents in result"}
2022-08-16T12:12:29.760+0100    fatal   server/startup_extra.go:79      error on updating system settings       {"error": "Get \"https://ipinfo.io/json\": dial tcp 0.0.0.0:443: connect: connection refused"}

MySensors naming scheme

Hello @jkandasa!

First of all I would like to thank you for your great work.
I use v1 since the beginning. Now it's time to move to v2. I welcome this because I have been using influx with telegtaf for a long time.
My request now: is it possible in influxdb (1.8) to get a naming scheme that matches the "external server" functionality of v1?
I have been using this form for a long time:
host=myController,gategatewayName=$gatewayName,nodeName=$nodeName,nodeEui=$nodeEui,sensorName=$sensorName,sensorId=$sensorId,variableType=$variableType,variableTypeId=$variableTypeId

Thank you and greetings from Austria

Analytics leads an issue on no internet

2022-03-30T20:21:01.484+0200	info	gateway/service.go:48	started a gateway	{"id": "GatewayUsb", "timeTaken": "8.431508ms"}
2022-03-30T20:21:03.055+0200	warn	provider/service.go:195	failed to parse	{"gateway": "GatewayUsb", "rawMessage": {"Data":"\ufffd#0;255;3;0;9;0 MCO:BGN:INIT GW,CP=RSNGA---,FQ=16,REL=255,VER=2.3.2","id":"","isReceived":true,"isAckEnabled":false,
"data":"nCMwOzI1NTszOzA7OTswIE1DTzpCR046SU5JVCBHVyxDUD1SU05HQS0tLSxGUT0xNixSRUw9MjU1LFZFUj0yLjMuMg==","timestamp":"2022-03-30T20:21:03.054987624+02:00",
"others":{}}, "error": "invalid node id: \ufffd#0"}
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x30 pc=0xb9ce48]

goroutine 56643 [running]:
github.com/mycontroller-org/server/v2/pkg/utils/http_client_json.(*ResponseConfig).StringBody(...)
	/home/runner/work/server/server/pkg/utils/http_client_json/client.go:31
github.com/mycontroller-org/server/v2/pkg/analytics.ReportAnalyticsData()
	/home/runner/work/server/server/pkg/analytics/mycontroller.go:114 +0xbc8
github.com/robfig/cron/v3.FuncJob.Run(0xe92e70)
	/home/runner/go/pkg/mod/github.com/robfig/cron/[email protected]/cron.go:136 +0x28
github.com/robfig/cron/v3.(*Cron).startJob.func1(0x4000312780, {0x10780a0, 0xe92e70})
	/home/runner/go/pkg/mod/github.com/robfig/cron/[email protected]/cron.go:312 +0x60
created by github.com/robfig/cron/v3.(*Cron).startJob
	/home/runner/go/pkg/mod/github.com/robfig/cron/[email protected]/cron.go:310 +0x68

Originally reported in https://forum.mycontroller.org/topic/508/scratch-analytics-enabled/1

MySensors native RSSI support

Hi @jkandasa,

I looked at the source code of MySensors v2.3.2 and did some manual tests regarding RSSI support.

  1. It seems the gateway itself cannot be queried for the RSSI since only the code from MyGatewayTransport.cpp gets processed for internal messages even when the MY_SIGNAL_REPORT_ENABLED symbol is defined in the sketch.

  2. Every other node will respond to internal signal messages when MY_SIGNAL_REPORT_ENABLED is defined in the sketch because code from MyTransport.cpp gets executed instead.

I found following I_SIGNAL_REPORT_REQUEST responses as mentioned in MyTransport.h from my node number 84 with a RFM69 radio by inserting the internal signal messages manually into the serial gateway where the last letter of the message switches the measurement method.

Received RSSI and 'reverse' transmitted RSSI in dBm:

84;0;3;0;29;R
84;255;3;0;31;-60
84;0;3;0;29;R!
84;255;3;0;31;-67

If I understood the code correctly the ! switches from RX to TX measurement a.k.a. from one-way measurement to two-way 'reverse' RSSI measurement derived from a ACK packet.

There is also the standalone transmitted RSSI but with some nonsense value (+127 dBm):

84;0;3;0;29;r
84;255;3;0;31;127

There exist also other internal signal messages for SNR (S, s, S!) TX power and percent (T, P) and uplink quality (U).

The only downside is that this works only if the node is not sleeping and if it has MY_SIGNAL_REPORT_ENABLED enabled in the sketch. If signal report is not enabled or a radio does not support a certain measurement method the value -256 is returned instead in the response message.

As mentioned in #2 in my case since I have a sleeping node it will not respond to signal requests. So I would have to use something like NodeManagers SensorSignal.h which shows up as a classic sensor message of type S_SOUND with V_LEVEL and sensor ID 202 which will be reported as soon as the node wakes up after transmitting some other sensor values. At the same time SensorSignal will enable also MY_SIGNAL_REPORT_ENABLED but without any effect when sleep mode is activated.

Gateway mqtt : "error on subscription:connection lost before"

Good morning,
I recently restarted MyController and I have this error coming back:

Connected successfully, error on subscription:connection lost before Subscribe completed

Connected successfully, error on subscription: connection lost before Subscribe completed
Once the error is present, only a stop and start of the service restarts operation until the next error...
I don't really understand, I tried to change the registration/publication topics a little but nothing works.
Note that I am with a Sensebender Gateway + ethernet shield + mqtt

My config:

id: Gateway_MySensors_MQTT
description: ''
enabled: true
reconnectDelay: 30s
queueFailedMessage: false
provider:
protocol:
broker: 192.168.1.12:1883
insecure: false
password: >-
ENCRYPTED;MC;AES256;BASE64;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
publish: mygateway1-in/#
qos: 0
subscribe: mygateway1-out/#
transmitPreDelay: 10ms
type: mqtt
username: xxxxxxxxxxxx
retryCount: 3
timeout: 500ms
type: mysensors_v2
messageLogger:
type: none
labels:
location: server
others: {}
state:
status: up
message: >-
Connected successfully, error on subscription:connection lost before
Subscribe completed
since: '2024-02-03T15:43:29.071824793+01:00'
modifiedOn: '0001-01-01T00:00:00Z'
lastTransaction: '0001-01-01T00:00:00Z'

And log :

mycontroller_1.log

If you have an idea, I'm interested.
Thank you so much

Concurrent map read/write race condition at startup

As mentioned in the forum I found a race condition at boot from my Raspberry Pi.

Attached you can find the crash log of my systemd service.
2021-08-16-07-41-mycontroller-crash.txt

I used this service file to start MyController v2:

[Unit]
Description=MyController.org v2 daemon
Requires=network.target
After=influxdb.service

[Service]
User=mycontroller
Group=mycontroller
WorkingDirectory=/opt/apps/mycontroller
ExecStart=/opt/apps/mycontroller/mycontroller-server -config /opt/apps/mycontroller/mycontroller.yaml

[Install]
WantedBy=multi-user.target

Kind regards

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.