Smarthome firmware pysmartnode

Discussion about programs, libraries and tools that work with MicroPython. Mostly these are provided by a third party.
Target audience: All users and developers of MicroPython.
Post Reply
kevinkk525
Posts: 89
Joined: Sat Feb 03, 2018 7:02 pm

Smarthome firmware pysmartnode

Post by kevinkk525 » Tue Jul 10, 2018 3:38 pm

I'd like to share my recently published "firmware" for easy smarthome deployment called pysmartnode, https://github.com/kevinkk525/pysmartnode. It's similar to ESPeasy in its usage target but a lot better as you can actually very easily create your own components in micropython and not C++. I have been working on this for over half a year now and hope that someone will find it useful.

The pysmartnode framework completely takes care of being connected to the mqtt broker, publishing basic device information, last will, sending logs over mqtt, optionally receive a configuration over mqtt and much more. It's configurable and lets you concentrate on programming your own scripts/modules/components.

On esp32 with psram you can just copy the files using ftp. Without psram you should at least generate bytecode first.
It's tested only on esp32 loboris fork but I don't see why it shouldn't run on the official esp32 firmware too.

Sadly I packed too many features into the core files with the last updates to version 3.8.1 and now it is only usable on esp8266 if you disable the filesystem. Have to fix that soon, sorry for that. (You disable the filesystem in the _boot.py)


With a configuration as simple as this in a file called "components.py" you load a component that publishes the free ram every 60s:

Code: Select all

COMPONENTS = {
    "_order": ["ram"],
    "ram": {
        "package": ".machine.ram",
        "component": "ram",
        "constructor_args": {
            "interval": 60
        }
    }
}
There are more standard components like a buzzer (with configurable sounds), led blinking, bell listener, temperature sensors, easyGPIO (to control all gpios by mqtt), a pms5003 air quality sensor and a few more which are all as easily configured as the example.
You can add your own sensors using a simple template and get it running in "no time".

I'd be glad if you try it and give me some feedback. Even if the feedback is like "this is crap, because ...". That would be helpful too.

kevinkk525
Posts: 89
Joined: Sat Feb 03, 2018 7:02 pm

Re: Smarthome firmware pysmartnode

Post by kevinkk525 » Wed Jul 18, 2018 11:52 am

Over one week without even a comment.. Guess the micropython world has not much need for something like this.. or is there some simple framework/firmware in micropython that I don't know of, which everyone uses? Or do you all write your own framework?

User avatar
pythoncoder
Posts: 2708
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Is it resilient?

Post by pythoncoder » Thu Jul 19, 2018 9:02 am

Have you tested the resilience of MQTT under conditions of poor WiFi communications? I found getting reliable operation quite difficult. To add to this you can never prove you've succeeded as there are so many ways a wireless link can be disrupted.

Some interesting tests are:
  • Run it for long periods (several days) logging long outages.
  • Run it while you slowly move the unit out of range of the AP, then gradually move it back into range.
  • Put the ESP and its power source into a Faraday cage then remove it (I used a microwave for this as you can see LED's inside).
I never achieved good resilience on ESP32, but the vendor OS has doubtless improved since I last looked at this. I plan to revisit my MQTT library once I get my hands on a sample of the new Pyboard.
Peter Hinch

kevinkk525
Posts: 89
Joined: Sat Feb 03, 2018 7:02 pm

Re: Smarthome firmware pysmartnode

Post by kevinkk525 » Thu Jul 19, 2018 10:41 am

Well, considering that I'm using your mqtt_as module, I'm quite confident that it is resilient.

It's a framework built on top of your mqtt_as module that simplifies communication, configuration and component addition.

SpotlightKid
Posts: 315
Joined: Wed Apr 08, 2015 5:19 am

Re: Smarthome firmware pysmartnode

Post by SpotlightKid » Thu Jul 19, 2018 11:26 am

I'm definitely interested in this project, I just didn't have time to check it out thoroughly yet. But I starred the Github project and told a friend about it, who's currently using ESPEasy.

kevinkk525
Posts: 89
Joined: Sat Feb 03, 2018 7:02 pm

Re: Smarthome firmware pysmartnode

Post by kevinkk525 » Thu Jul 19, 2018 11:30 am

Thank you for your feedback. It's nice to hear that there is some interest.

User avatar
pythoncoder
Posts: 2708
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: Smarthome firmware pysmartnode

Post by pythoncoder » Fri Jul 20, 2018 4:53 am

Oops - sorry, I should have read the docs properly :oops:

I'm interested in this too, when I manage to find some time to try it.
Peter Hinch

Post Reply