Code Monkey home page Code Monkey logo

picow_homeassistant_starter's People

Contributors

daniloc avatar kylefmohr avatar tmp2k 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  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  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  avatar  avatar  avatar  avatar

picow_homeassistant_starter's Issues

Missing MQTT_LOGIN & MQTT_PASSWORD still indicates connected to MQTT broker.

If MQTT_LOGIN & MQTT_PASSWORD left blank:

#define MQTT_LOGIN ""
#define MQTT_PASSWORD ""

Application still indicates that it connects to the MQTT Broker but Controls do not work.

--- More details at https://bit.ly/pio-monitor-filters
--- Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H
21:39:44.381 > Connected to
21:39:44.381 > Tajin
21:39:44.382 > Connecting to MQTT
21:39:44.383 > Connected to MQTT broker

If I add the LOGIN and PASSWORD everything works fine.

HA MQTT Integration only discovers a single device.

So I 'm not sure where the issues is here but I'm trying to connect two Pico Pi MQTT devices to HA. I can see that both are reporting unique ID's to HA's broker but only a single device is being discovered in HA. Though I don't think they need it, they both have unique names but otherwise the firmware is probably identical.

I belive the four clients are: 1: HA's MQTT Broker, 2: MQTT Explorer, 3: Pico Pi, 4: Pico Pi
image

And in HA I see this:
image

And indeed the device looks correct:
image

I feel like this is an issue with mosquitto but it could be due to a discovery issues with this project or AHA.

Error: Please specify `upload_port` for environment or use global `--upload-port` option.

I was testing this project on LInux and getting this issue:

Error: Please specify `upload_port` for environment or use global `--upload-port` option.
For some development platforms it can be a USB flash drive (i.e. /media/<user>/<device name>)
*** [upload] Explicit exit, status 1

I was due to firmware running on the Pico Pi W not having a serial port. To resolve the issues I uploaded a sketch from the ASCII Table Sketch from the Arduino IDE.

I'm not sure how to fix this from Platform IO.

It might be nice if the README.md had a bit of guidance on this issue.

Build system question

@daniloc How do you build this project? I've been working in Linux but I'm trying to build on my Windows laptop and have all kinds of issues. If I use the default raspberrypi package I get a missing package or platfom json file (I can't see the exact one now but I'll up date this later. If I try to use the same commit of the pico package that I"m using on my Linux machine I take like 5-15 minutes to clone a bunch of stuff then ultimately fails. If I had to guess your using a mac (especially becuase of the mac-post-upload.py script in the package).

Errors trying to compile

Trying to compile the project I get the following errors:
Compiling .pio/build/pico/lib74c/home-assistant-integration/HAMqtt.cpp.o
src/HAIntegration.cpp:15:26: error: no matching function for call to 'HASwitch::HASwitch(const char [4], bool)'
15 | HASwitch led("led", false);
| ^

src/HAIntegration.cpp:36:9: error: 'class HASwitch' has no member named 'onStateChanged'
36 | led.onStateChanged(switchHandler);
| ^~~~~~~~~~~~~~
Compiling .pio/build/pico/lib74c/home-assistant-integration/device-types/HABaseDeviceType.cpp.o
*** [.pio/build/pico/src/HAIntegration.cpp.o] Error 1

Feature Request: Add pointer in HABaseDeviceType to a generic struct (or class)

I would be nice if the HABaseDeviceType class had a pointer to a struct (or class) that could be used to hold arbitrary data per users need. This would allow adding information that could be retrieved by a generic handler. This would allow you to do things like this:

class ZoneData {
    public:
        uint8_t led_pin;
        uint8_t ssr_pin;
};

void HAIntegration::switchHandler(bool state, HASwitch* sender) {
    digitalWrite(((ZoneData)sender->data).led_pin, (state ? HIGH : LOW));
    digitalWrite(((ZoneData)sender->data).ssr_pin, (state ? HIGH : LOW));
    sender->setState(state);  // report state back to Home Assistant
}

analogWrite doesn't seem to work

I'm trying to make a very simple system that makes an LED fade up and down when a switch hasn't been turned on. Frustratingly I cannot get analogWrite to work in any way whatsoever.

To confirm, I've stripped back main.cpp of pretty much everything but Arduino.h and even there, I cannot turn on the LED using analogWrite, but I can with digitalWrite.

I'm struggling to think what I could be doing wrong, I've tried every possible google search I can think of but everything is for C or python in ArduinoIDE but never C++ in VSCode so even though this seems a bit off topic for the scope of this project, I'm hoping you'll be happy to assist anyway seeing as I'm using it as a basis :(

Screenshot 2023-07-30 at 21 15 45

Upload fails on Linux due to Mac-specific script in platformio.ini

My Linux system complains that osascript doesn't exist in the post-upload step, due to mac-post-upload.py. Could platformio.ini be set up to only run this step on Mac systems? Or maybe add an OS check to mac-post-upload.py?

I was able to get the upload to work by just removing the script from platformio.ini.

(I may submit a pull request for this later, just wanted to throw it out there in case someone else wanted to get to it before me since it's probably not too complicated)

HAMqtt::etDataPrefix() misses some cases (avty_t = online)

mqtt.setDataPrefix("plp") misses some cases. Here you can see I end up with an "aha" node which means that this is probably hardcoded somewhere (or set prior to changing the prefix). This is probably a bug in the AHA but I know you have forked this as well and I'm using your fork.

image

avty_t = online

[FEATURE] Enable Last Will and Testament

Enabling the LWT (Last Will and Testament) feature requires adding three lines of code and add the very cool functionality of giving HA the ability to detect if the device looses power.

    device.enableSharedAvailability(); // [OPTIONAL] Enables the ability to set the on/off line status of the device
    device.setAvailability(true); // Set the device to on-line
    device.enableLastWill(); // [OPTIONAL] Allows HA to detect when the device losses power (and thus disable the controls in the HA UI)

Extraneous MQTT Switch

Initial issue was that not all HASwitches were showing up:

HASwitch led("led");
HASwitch zone[] = { 
    HASwitch("Zone0"),
    HASwitch("Zone1"),
    HASwitch("Zone2"),
    HASwitch("Zone3"),
    HASwitch("Zone4"),
    HASwitch("Zone5"),
    HASwitch("Zone6"),
    HASwitch("Zone7"),
    HASwitch("Zone8"),
    HASwitch("Zone9"),
};

(snip)

    // handle switch state
    led.onCommand(switchHandler);
    led.setName("FlowBot LED"); // optional

    // Zone state
    for(uint8_t i = 0; i < 10; i++)
    {
        zone[i].onCommand(switchHandler);
    }
    zone[0].setName("Zone 0"); // optional
    zone[1].setName("Zone 1"); // optional
    zone[2].setName("Zone 2"); // optional
    zone[3].setName("Zone 3"); // optional
    zone[4].setName("Zone 4"); // optional
    zone[5].setName("Zone 5"); // optional
    zone[6].setName("Zone 6"); // optional
    zone[7].setName("Zone 7"); // optional
    zone[8].setName("Zone 8"); // optional
    zone[9].setName("Zone 9"); // optional

image

And for some reason one of the switches comes up unnamed ("MQTT Switch").

[SUGGESTION] Rename HAIntegration::configure() to either HAIntegration::begin() or HAIntegration::setup()

Rename HAIntegration::configure() to either HAIntegration::begin() or HAIntegration::setup() for more orthogonal naming with the Wiring/Arduino naming conventions.

I feel like begin() better matches other Arduino classes in how its used, but because of the loop() it really feels like it should be called setup().

Frankly, configure() doesn't really bother me either, but I think begin() or setup() really hits home as to what this function is doing and where it probably should be called from.

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.