Code Monkey home page Code Monkey logo

ha-mqtt-iot's People

Contributors

dev-foo-bar avatar pa-sowa avatar phallows avatar w-floyd 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

ha-mqtt-iot's Issues

system.sh CPU usage does not update

Perhaps it's just my system, but it does not update. I think it is reporting the average since boot?

Edit: If I run mpstat 1 it reports the correct statistics over time. It is running it a single time that is problematic.

Using mpstat 1 1 works

Bring back automatic device generation

This used to be a thing ages ago (I had battery status, backlight, that come to mind). I want to redo this and extend it to more cases, such as:

  • Hard Drives / Paritions (Overall size, space used, amount of data written/read, SMART data, etc.)
  • Battery (Level, health, discharge rate)
  • CPU stats (Model, usage, governor, power draw, per-core stats, cache, frequency, etc.)
  • GPU stats (Model, usage, power, memory usage, frequency, etc.)
  • Memory stats (Model, usage, power, etc.)
  • Monitor controls (Laptop brightness, desktop monitor brightness via ddccontrol, DE color temperature controls integrated)

Ideally, we should not implement all of these things ourselves, and certainly not in this repo - if we need to, it might make sense to create an external library that may provide all of this information. I am sure this is something we can find elsewhere.

Allow re-using program output in multiple devices

I think it should be possible to do hack our way into this pretty easily at the moment, but it would require some fiddling with topics and such. Instead, I propose that I change to a model of commands generating a single topic output, which we can then reference easily per-device. For example, nvidia-smi has a ton of great data, but we currently have to probe it multiple times. Why not re-use this output? For example, we could create a topic of /ha-mqtt-iot/<deivce>/state/gpu/0 which will carry a full JSON output of what we want, and then use value_template on many entities to derive all the sensors we want. Probe once, post once, just tell HomeAssistant where to look.

In cases where we don't have more than one entity as a result of a command, we can still use the same format - keep it simple. Topic generation needs to be automatic.

A first thought at this is to name a command in one place, and reference it per entity - so each place we currently allow providing a function would now be a reference.

Issue connecting more than one instance at a time.

DEBUG[client]   Connect()
DEBUG[store]    memorystore initialized
DEBUG[client]   about to write new connect msg
DEBUG[client]   socket connected to broker
DEBUG[client]   Using MQTT 3.1.1 protocol
DEBUG[net]      connect started
DEBUG[net]      received connack
DEBUG[client]   startCommsWorkers called
DEBUG[client]   client is connected/reconnected
DEBUG[net]      incoming started
DEBUG[net]      startIncomingComms started
DEBUG[net]      outgoing started
DEBUG[net]      startComms started
DEBUG[pinger]   keepalive starting
DEBUG[client]   startCommsWorkers done
DEBUG[client]   exit startClient
DEBUG[net]      logic waiting for msg on ibound
DEBUG[net]      startIncomingComms: inboundFromStore complete
DEBUG[net]      logic waiting for msg on ibound
DEBUG[net]      outgoing waiting for an outbound message
DEBUG[client]   enter Publish
DEBUG[client]   sending publish message, topic: homeassistant/binary_sensor/ha-mqtt-iot/work-mode-paused-desktop/config
DEBUG[net]      obound msg to write 0
DEBUG[net]      obound wrote msg, id: 0
DEBUG[net]      outgoing waiting for an outbound message
DEBUG[client]   enter Publish
DEBUG[client]   sending publish message, topic: homeassistant/binary_sensor/ha-mqtt-iot/work-mode-desktop/config
DEBUG[net]      obound msg to write 0
DEBUG[client]   enter Publish
DEBUG[client]   sending publish message, topic: homeassistant/switch/ha-mqtt-iot/dark-mode/config
DEBUG[client]   enter Publish
DEBUG[client]   sending publish message, topic: homeassistant/sensor/ha-mqtt-iot/work-duration/config
DEBUG[client]   enter Publish
DEBUG[net]      obound wrote msg, id: 0
DEBUG[net]      outgoing waiting for an outbound message
DEBUG[client]   sending publish message, topic: homeassistant/switch/ha-mqtt-iot/desktop-monitor-awake/config
DEBUG[net]      obound msg to write 0
DEBUG[client]   enter Publish
DEBUG[net]      obound wrote msg, id: 0
DEBUG[net]      outgoing waiting for an outbound message
DEBUG[net]      obound msg to write 0
DEBUG[net]      obound wrote msg, id: 0
DEBUG[net]      outgoing waiting for an outbound message
DEBUG[client]   sending publish message, topic: homeassistant/sensor/ha-mqtt-iot/work-started/config
DEBUG[net]      obound msg to write 0
DEBUG[net]      obound wrote msg, id: 0
DEBUG[net]      outgoing waiting for an outbound message
DEBUG[net]      obound msg to write 0
DEBUG[net]      obound wrote msg, id: 0
DEBUG[net]      outgoing waiting for an outbound message
DEBUG[net]      incoming complete
DEBUG[net]      startIncomingComms: got msg on ibound
DEBUG[net]      logic waiting for msg on ibound
DEBUG[net]      startIncomingComms: ibound complete
DEBUG[net]      startIncomingComms goroutine complete
DEBUG[net]      outgoing waiting for an outbound message
ERROR[client]   Connect comms goroutine - error triggered EOF
DEBUG[client]   internalConnLost called
DEBUG[client]   stopCommsWorkers called
DEBUG[client]   startCommsWorkers output redirector finnished
DEBUG[net]      outgoing waiting for an outbound message
DEBUG[net]      outgoing waiting for an outbound message
DEBUG[net]      outgoing comms stopping
DEBUG[pinger]   keepalive stopped
DEBUG[client]   stopCommsWorkers waiting for workers
DEBUG[net]      startComms closing outError
DEBUG[router]   matchAndDispatch exiting
DEBUG[client]   stopCommsWorkers waiting for comms
DEBUG[client]   comms goroutine done
DEBUG[client]   internalConnLost waiting on workers
DEBUG[client]   stopCommsWorkers done
DEBUG[client]   internalConnLost workers stopped
DEBUG[client]   internalConnLost complete
DEBUG[client]   enter reconnect
DEBUG[client]   about to write new connect msg
DEBUGConnection lost: EOF
DEBUG[client]   socket connected to broker
DEBUG[client]   Using MQTT 3.1.1 protocol
DEBUG[net]      connect started
DEBUG[net]      received connack
DEBUG[client]   startCommsWorkers called
DEBUG[client]   client is connected/reconnected
DEBUG[net]      incoming started
DEBUG[net]      startIncomingComms started
DEBUG[net]      outgoing started
DEBUG[net]      startComms started
DEBUG[client]   startCommsWorkers done
DEBUG[store]    enter Resume
DEBUG[store]    exit resume
DEBUG[pinger]   keepalive starting
DEBUG[net]      logic waiting for msg on ibound
DEBUG[net]      startIncomingComms: inboundFromStore complete
DEBUG[net]      logic waiting for msg on ibound
DEBUG[net]      outgoing waiting for an outbound message
DEBUG[client]   enter Publish
DEBUG[client]   enter Publish
DEBUG[client]   sending publish message, topic: homeassistant/sensor/ha-mqtt-iot/work-started/config
DEBUG[net]      obound msg to write 0
DEBUG[client]   enter Publish
DEBUG[client]   sending publish message, topic: homeassistant/binary_sensor/ha-mqtt-iot/work-mode-paused-desktop/config
DEBUG[client]   sending publish message, topic: homeassistant/sensor/ha-mqtt-iot/work-duration/config
DEBUG[client]   enter Publish
DEBUG[client]   sending publish message, topic: homeassistant/binary_sensor/ha-mqtt-iot/work-mode-desktop/config
DEBUG[client]   enter Publish
DEBUG[client]   sending publish message, topic: homeassistant/switch/ha-mqtt-iot/dark-mode/config
DEBUG[net]      obound wrote msg, id: 0
DEBUG[net]      outgoing waiting for an outbound message
DEBUG[net]      obound msg to write 0
DEBUG[client]   enter Publish
DEBUG[net]      obound wrote msg, id: 0
DEBUG[net]      outgoing waiting for an outbound message
DEBUG[net]      obound msg to write 0
DEBUG[net]      obound wrote msg, id: 0
DEBUG[net]      outgoing waiting for an outbound message
DEBUG[net]      obound msg to write 0
DEBUG[net]      obound wrote msg, id: 0
DEBUG[net]      outgoing waiting for an outbound message
DEBUG[net]      obound msg to write 0
DEBUG[net]      obound wrote msg, id: 0
DEBUG[client]   sending publish message, topic: homeassistant/switch/ha-mqtt-iot/desktop-monitor-awake/config
DEBUG[net]      outgoing waiting for an outbound message
DEBUG[net]      obound msg to write 0
DEBUG[net]      obound wrote msg, id: 0
DEBUG[net]      outgoing waiting for an outbound message
DEBUG[net]      incoming complete
DEBUG[net]      startIncomingComms: got msg on ibound
DEBUG[net]      logic waiting for msg on ibound
DEBUG[net]      startIncomingComms: ibound complete
DEBUG[net]      startIncomingComms goroutine complete
DEBUG[net]      outgoing waiting for an outbound message
ERROR[client]   Connect comms goroutine - error triggered EOF
DEBUG[client]   internalConnLost called
DEBUG[client]   stopCommsWorkers called
DEBUG[client]   startCommsWorkers output redirector finnished
DEBUG[net]      outgoing waiting for an outbound message
DEBUG[net]      outgoing waiting for an outbound message
DEBUG[net]      outgoing comms stopping
DEBUG[router]   matchAndDispatch exiting
DEBUG[net]      startComms closing outError
DEBUG[pinger]   keepalive stopped
DEBUG[client]   comms goroutine done
DEBUG[client]   stopCommsWorkers waiting for workers
DEBUG[client]   stopCommsWorkers waiting for comms
DEBUG[client]   stopCommsWorkers done
DEBUG[client]   internalConnLost waiting on workers
DEBUG[client]   internalConnLost workers stopped
DEBUG[client]   internalConnLost complete
DEBUGConnection lost: EOF
DEBUG[client]   enter reconnect
DEBUG[client]   about to write new connect msg
DEBUG[client]   socket connected to broker
DEBUG[client]   Using MQTT 3.1.1 protocol
DEBUG[net]      connect started
DEBUG[net]      received connack
DEBUG[client]   startCommsWorkers called
DEBUG[client]   client is connected/reconnected
DEBUG[net]      incoming started
DEBUG[net]      startIncomingComms started
DEBUG[net]      outgoing started
DEBUG[net]      startComms started
DEBUG[pinger]   keepalive starting
DEBUG[client]   startCommsWorkers done
DEBUG[store]    enter Resume
DEBUG[store]    exit resume
DEBUG[net]      outgoing waiting for an outbound message
DEBUG[net]      logic waiting for msg on ibound
DEBUG[net]      startIncomingComms: inboundFromStore complete
DEBUG[net]      logic waiting for msg on ibound
DEBUG[client]   enter Publish
DEBUG[client]   sending publish message, topic: homeassistant/binary_sensor/ha-mqtt-iot/work-mode-paused-desktop/config
DEBUG[client]   enter Publish
DEBUG[client]   enter Publish
DEBUG[client]   sending publish message, topic: homeassistant/switch/ha-mqtt-iot/dark-mode/config
DEBUG[client]   enter Publish
DEBUG[client]   sending publish message, topic: homeassistant/switch/ha-mqtt-iot/desktop-monitor-awake/config
DEBUG[client]   enter Publish
DEBUG[client]   sending publish message, topic: homeassistant/sensor/ha-mqtt-iot/work-started/config
DEBUG[client]   sending publish message, topic: homeassistant/sensor/ha-mqtt-iot/work-duration/config
DEBUG[net]      obound msg to write 0
DEBUG[net]      obound wrote msg, id: 0
DEBUG[net]      outgoing waiting for an outbound message
DEBUG[net]      obound msg to write 0
DEBUG[client]   enter Publish
DEBUG[net]      obound wrote msg, id: 0
DEBUG[net]      outgoing waiting for an outbound message
DEBUG[client]   sending publish message, topic: homeassistant/binary_sensor/ha-mqtt-iot/work-mode-desktop/config
DEBUG[net]      obound msg to write 0
DEBUG[net]      obound wrote msg, id: 0
DEBUG[net]      outgoing waiting for an outbound message
DEBUG[net]      obound msg to write 0
DEBUG[net]      obound wrote msg, id: 0
DEBUG[net]      outgoing waiting for an outbound message
DEBUG[net]      obound msg to write 0
DEBUG[net]      obound wrote msg, id: 0
DEBUG[net]      outgoing waiting for an outbound message
DEBUG[net]      obound msg to write 0
DEBUG[net]      obound wrote msg, id: 0
DEBUG[net]      outgoing waiting for an outbound message
DEBUG[net]      incoming complete
DEBUG[net]      startIncomingComms: got msg on ibound
DEBUG[net]      logic waiting for msg on ibound
DEBUG[net]      startIncomingComms: ibound complete
DEBUG[net]      startIncomingComms goroutine complete
DEBUG[net]      outgoing waiting for an outbound message
ERROR[client]   Connect comms goroutine - error triggered EOF
DEBUG[client]   internalConnLost called
DEBUG[client]   stopCommsWorkers called
DEBUG[client]   startCommsWorkers output redirector finnished
DEBUG[pinger]   keepalive stopped
DEBUG[net]      outgoing waiting for an outbound message
DEBUG[client]   stopCommsWorkers waiting for workers
DEBUG[router]   matchAndDispatch exiting
DEBUG[client]   internalConnLost waiting on workers
DEBUG[client]   stopCommsWorkers waiting for comms
DEBUG[net]      outgoing waiting for an outbound message
DEBUG[net]      outgoing comms stopping
DEBUG[net]      startComms closing outError
DEBUG[client]   comms goroutine done
DEBUG[client]   stopCommsWorkers done
DEBUG[client]   internalConnLost workers stopped
DEBUG[client]   internalConnLost complete
DEBUGConnection lost: EOF
DEBUG[client]   enter reconnect
DEBUG[client]   about to write new connect msg
DEBUG[client]   enter Publish
DEBUG[client]   enter Publish
DEBUG[client]   enter Subscribe
2020/10/23 03:36:56 not currently connected and ResumeSubs not set

Light config does not work and causes error message

The following message keeps appearing, looping

DEBUG[net]      logic waiting for msg on ibound
DEBUG[net]      startIncomingComms: got msg on ibound
DEBUG[net]      startIncomingComms: received publish, msgId: 0
DEBUG[net]      startIncoming Received Message

with a config of:

    "lights": [
        {
            "info": {
                "name": "Desktop Monitor",
                "id": "monitor"
            },
            "command": [
                "./scripts/monitor.sh",
                "command"
            ],
            "command_state": [
                "./scripts/monitor.sh",
                "command-state"
            ],
            "command_color_temp": [
                "./scripts/monitor.sh",
                "color-temp"
            ],
            "command_color_temp_state": [
                "./scripts/monitor.sh",
                "color-temp-state"
            ],
            "command_brightness": [
                "./scripts/monitor.sh",
                "brightness"
            ],
            "command_brightness_state": [
                "./scripts/monitor.sh",
                "brightness-state"
            ],
            "brightness_scale": 100,
            "update_interval": 5
        }
    ],

Add `text` entity type

Got added in 2022.12, should be pretty simple up add to the helper, and is actually a really good use case for this tool.

Support SSL

Should be simple, adding a option to the config to load an cert file.

Allow option of pushing data to ha-mqtt-iot instead of polling only

Being able to push data to this tool would improve latency/reduce polling, and allow more complicated tools to be decoupled much easier. I am not a computer scientist, so my immediate thought is to allow using a Unix socket (if available?), or maybe just a file to write the state to. Any accompanying program would then watch the state to take commands.

App doesn't reconnect on lost connection

When I suspend and later resume my computer it loses connection to the MQTT server and doesn't attempt to reconnect. I need to restart the app manually.
I see this error:
ERROR [client] Connect comms goroutine - error triggered read tcp 192.168.1.52:46248->192.168.1.45:1883: read: connection reset by peer

Support all HomeAssistant MQTT devices

  • Alarm control panels
  • Binary sensors
  • Buttons
  • Cameras
  • Covers
  • Device Trackers
  • Device Triggers
  • Fans
  • Humidifiers
  • HVACs
  • Lights
  • Locks
  • Numbers
  • Scenes
  • Selects
  • Sensors
  • Sirens
  • Switches
  • Tag Scanners
  • Vacuums

Validate all device types

While I have reasonable confidence that most simple device types will work, I expect there to be issues in the more complicated device types. I will consider a device validated when I have an example in the sample config. Further validation will be required in future, this is just a first pass.

  • Alarm control panels
  • Binary sensors
  • Buttons
  • Cameras
  • Covers
  • Device Trackers
  • Device Triggers
  • Fans
  • Humidifiers
  • HVACs
  • Lights
  • Locks
  • Numbers
  • Scenes
  • Selects
  • Sensors
  • Sirens
  • Switches
  • Tag Scanners
  • Update
  • Vacuums

Code generation is broken

As of 2023.08, code generation is broken (slice out of bounds). Need to check what is broken exactly, likely config block is changed in a file.

Add camera type

Possibly add builtin for sending periodic screen captures.

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.