Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
fabyteF

fabyte

@fabyte
About
Posts
21
Topics
1
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • A tiny BME node - BME280 on ATtiny85
    fabyteF fabyte

    Hi @chamroeun-ou
    please try and add the following on top of your main.cpp:

    // -----------------------------------------------------------------------------
    // missing defines
    // -----------------------------------------------------------------------------
    #define SIGRD   RSIG    // Signature Row from Store Program Memory Control and Status Register
    #define EIFR    GIFR    // External/General Interrupt Flag Register
    #define WDTCSR  WDTCR   // WDT Control Register
    // #define TCCR1A TCCR1
    // #define TIFR1 TIFR
    extern void serialEventRun(void) __attribute__((weak));
    
    My Project

  • OH3 - MySensors Binding
    fabyteF fabyte

    @haloway13 Yes, everything via the web interface

    OpenHAB

  • OH3 - MySensors Binding
    fabyteF fabyte

    @haloway13 I had exactly the same problem.
    Here is what I did to fix it:

    1. uninstalled the mqtt binding
      1.1 make sure the /opt/openhab/userdata/config/org/openhab/mqttbroker.config is removed
    2. installed the mqtt binding
    3. setup the system broker

    After that, the system broker connection could be established and the Try to restore connection to '192.168.1.151'. Next attempt in 60000ms messaged disappeared.

    Then you can proceed and set up the MySensors MQTT Bridge.

    OpenHAB

  • OH3 - MySensors Binding
    fabyteF fabyte

    @TimO Congratulations on your child :clap:
    I know it's an exciting time and definitely more important than developing a OH binding :grin:
    Spending time with your family should always be number 1 priority and you can't blame anyone for taking time off from a internet community :)

    OpenHAB

  • OH3 - MySensors Binding
    fabyteF fabyte

    After reinstalling the mqtt bindung the MQTT System Broker connection now could be established - strange, that a reinstall was required since I did several OpenHAB system restarts and those didn't fix it.

    Well, now the MySensors binding is working with the system broker:
    Screenshot 2021-02-22 195800.png
    Here's a MySensors temperature item:
    Screenshot 2021-02-22 201902.png

    To sum up, here's what I did

    1. (manually) installed MySensors binding
    2. uninstalled mqtt binding
    3. installed mqtt binding
    4. set up the MQTT system broker connection
      4.1 set Connection Name to systembroker
      4.2 set Broker Host to localhost (it's running on the same device)
      4.3 Show advanced -> set Broker Port to 1883 since it was always using 8883 but I don't use a secure connection
      (4.4 I didn't set a clientid, no user and no password)
    5. set up the MySensors MQTT Gateway thing
      5.1 set Broker Name to systembroker
    OpenHAB

  • OH3 - MySensors Binding
    fabyteF fabyte

    @ncollins Yes, it looks like some resources are blocked or not resolved correctly when using the system broker.
    But the system broker functionality comes with the mqtt binding itself. Here is a screen of the settings when I deleted the mqtt binding:
    2.png

    Also I never got the system broker working, even without defining a generic mqtt broker thing.

    OpenHAB

  • OH3 - MySensors Binding
    fabyteF fabyte

    Okay, now i tried to configure the MQTT system broker connection and this seems to work.

    • I set up the system broker and named it 'mosquitto'.
    • in the MySensors MQTT bridge, as before, I used mosquitto as Broker Name. Now the Broker Name could be resolved and the Thing is online.
    10:12:55.086 [DEBUG] [ensors.handler.MySensorsBridgeHandler] - Initialization of the MySensors bridge
    10:12:55.089 [DEBUG] [sensors.factory.MySensorsCacheFactory] - Cache file: given_ids.cached not exist.
    10:12:55.091 [DEBUG] [sensors.factory.MySensorsCacheFactory] - Cache file: given_ids.cached not exist. Default passed, creating it...
    10:12:55.094 [DEBUG] [sensors.factory.MySensorsCacheFactory] - Writing on cache given_ids, content: []
    10:12:55.100 [DEBUG] [sensors.factory.MySensorsCacheFactory] - Cache (given_ids) content: []
    10:12:55.103 [DEBUG] [protocol.mqtt.MySensorsMqttConnection] - Enabling connection watchdog
    10:12:55.106 [DEBUG] [ensors.handler.MySensorsBridgeHandler] - Initialization of the MySensors bridge DONE!
    10:12:55.108 [ERROR] [protocol.mqtt.MySensorsMqttConnection] - MQTT connection offline - Reason unknown
    10:12:55.113 [DEBUG] [s.discovery.MySensorsDiscoveryService] - Starting MySensors discovery scan
    10:12:55.117 [DEBUG] [protocol.mqtt.MySensorsMqttConnection] - Adding consumer for topic: mygateway1-out/+/+/+/+/+
    10:12:55.127 [WARN ] [protocol.mqtt.MySensorsMqttConnection] - Skipping I_VERSION connection test, not recommended...
    10:12:55.133 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing 'mysensors:bridge-mqtt:84dd4a387f' changed from INITIALIZING to ONLINE
    10:12:55.133 [DEBUG] [sensors.factory.MySensorsCacheFactory] - Writing on cache given_ids, content: []
    10:12:55.139 [INFO ] [protocol.mqtt.MySensorsMqttConnection] - Successfully connected to MySensors Bridge.
    

    But
    I'm having troubles with the MQTT system broker, it can't connect the broker instance.

    com.hivemq.client.mqtt.exceptions.ConnectionClosedException: java.io.IOException: Connection reset by peer
    Caused by: java.io.IOException: Connection reset by peer
            at sun.nio.ch.FileDispatcherImpl.read0(Native Method) ~[?:?]
            at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:39) ~[?:?]
            at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:276) ~[?:?]
            at sun.nio.ch.IOUtil.read(IOUtil.java:233) ~[?:?]
            at sun.nio.ch.IOUtil.read(IOUtil.java:223) ~[?:?]
            at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:358) ~[?:?]
            at io.netty.buffer.PooledByteBuf.setBytes(PooledByteBuf.java:247) ~[bundleFile:4.1.42.Final]
            at io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:1147) ~[bundleFile:4.1.42.Final]
            at io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:347) ~[bundleFile:4.1.42.Final]
            at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:148) [bundleFile:4.1.42.Final]
            at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:700) [bundleFile:4.1.42.Final]
            at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:635) [bundleFile:4.1.42.Final]
            at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:552) [bundleFile:4.1.42.Final]
            at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:514) [bundleFile:4.1.42.Final]
            at io.netty.util.concurrent.SingleThreadEventExecutor$6.run(SingleThreadEventExecutor.java:1044) [bundleFile:4.1.42.Final]
            at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) [bundleFile:4.1.42.Final]
            at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) [bundleFile:4.1.42.Final]
            at java.lang.Thread.run(Thread.java:834) [?:?]
    

    Since this seems more a OpenHAB/mosquitto issue I will dig into it myself.

    Edit
    The MQTT System Broker seems to be a concept from OH2, where a MQTT broker was shipped internally with OpenHAB and it seems to be broken in OH3 (OH Forum).

    This leaves me with the following conclusions:

    1. The MySensors binding configuration references the MQTT system broker connection
    2. With OH3, this MQTT System Broker is not working anymore.

    I suppose the correct way of handling this issue is to make the MySensors binding reference a normal MQTT Broker bridge, not a System Broker bridge.
    Anyone who knows what changes this would require? My guess is that it should be manageable -> Source Code

    OpenHAB

  • OH3 - MySensors Binding
    fabyteF fabyte

    @ncollins Thanks, really appreciate it :) Let me know if you need more info, here's the basic config I did:

    • created a mqtt broker (not system broker) This thing is ONLINE
    UID: mqtt:broker:mosquitto
    label: mosquitto
    thingTypeUID: mqtt:broker
    configuration:
      lwtQos: 0
      publickeypin: true
      keepAlive: 60
      clientid: 566e1af2-19c2-4596-904f-18b89c502e53
      qos: 0
      reconnectTime: 60000
      host: localhost
      secure: false
      certificatepin: true
      lwtRetain: true
      enableDiscovery: true
    
    • created a MySensors MQTT Bridge with default settings (brokername = mosquitto)
    UID: mysensors:bridge-mqtt:01d212b118
    label: MySensors MQTT Gateway
    thingTypeUID: mysensors:bridge-mqtt
    configuration:
      networkSanCheckSendHeartbeat: false
      topicPublish: mygateway1-in
      networkSanCheckInterval: 3
      networkSanCheckSendHeartbeatFailAttempts: 10
      topicSubscribe: mygateway1-out
      networkSanCheckEnabled: false
      networkSanCheckConnectionFailAttempts: 3
      startupCheckEnabled: false
      brokerName: mosquitto
      imperial: false
      sendDelay: 100
    

    Here's the logs:

    09:59:32.973 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing 'mysensors:bridge-mqtt:01d212b118' changed from UNINITIALIZED to INITIALIZING
    09:59:32.980 [DEBUG] [ensors.handler.MySensorsBridgeHandler] - Initialization of the MySensors bridge
    09:59:32.994 [DEBUG] [sensors.factory.MySensorsCacheFactory] - Cache file: given_ids.cached not exist.
    09:59:32.995 [DEBUG] [sensors.factory.MySensorsCacheFactory] - Cache file: given_ids.cached not exist. Default passed, creating it...
    09:59:32.997 [DEBUG] [sensors.factory.MySensorsCacheFactory] - Writing on cache given_ids, content: []
    09:59:32.998 [DEBUG] [sensors.factory.MySensorsCacheFactory] - Cache (given_ids) content: []
    09:59:33.011 [DEBUG] [protocol.mqtt.MySensorsMqttConnection] - Enabling connection watchdog
    09:59:33.015 [DEBUG] [ensors.handler.MySensorsBridgeHandler] - Initialization of the MySensors bridge DONE!
    09:59:33.016 [DEBUG] [s.discovery.MySensorsDiscoveryService] - Starting MySensors discovery scan
    09:59:33.022 [ERROR] [protocol.mqtt.MySensorsMqttConnection] - No connection to broker: mosquitto
    09:59:33.027 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing 'mysensors:bridge-mqtt:01d212b118' changed from INITIALIZING to OFFLINE
    09:59:33.027 [DEBUG] [sensors.factory.MySensorsCacheFactory] - Writing on cache given_ids, content: []
    09:59:33.029 [ERROR] [protocol.mqtt.MySensorsMqttConnection] - Failed connecting to bridge...next retry in 10 seconds (Retry No.:0)
    

    I tried different broker names (like mqtt:broker:mosquitto, the clientid, different uid names, but the log always says the broker cannot be found. It maps to the following lines: link

    I can provide more info if needed and try out debug versions of the binding if required.

    OpenHAB

  • OH3 - MySensors Binding
    fabyteF fabyte

    @ncollins Any chance this rebased work will be pushed upstream to the openhab/openhab-addons repo? Mainline support could help this binding with future framework changes and avoid reverse engineering of code changes and simplifies the binding installation.

    Also any ideas on the MQTT bridge problem? Somehow the broker name cannot be resolved as also discussed here:
    https://forum.mysensors.org/topic/10184/help-openhab-2-4-binding-mqtt

    OpenHAB

  • A tiny BME node - BME280 on ATtiny85
    fabyteF fabyte

    Last year I began with the work on the SMD version of the tiny BME node. See pictures here:

    20200624_110630_small.jpg
    20200624_110645_small.jpg

    Problem was that the radio isn't transmitting very reliable and I think I broke it while programming the ATTINY (used 5V instead of 3.3V). I received a few values so I know it is working but I didn't have time to fix it properly which would mean just create a new one.

    My Project

  • A tiny BME node - BME280 on ATtiny85
    fabyteF fabyte

    @icebob Sure, no thing:

    // -----------------------------------------------------------------------------
    // missing defines
    // -----------------------------------------------------------------------------
    #define SIGRD   RSIG    // Signature Row from Store Program Memory Control and Status Register
    #define EIFR    GIFR    // External/General Interrupt Flag Register
    #define WDTCSR  WDTCR   // WDT Control Register
    // #define TCCR1A TCCR1
    // #define TIFR1 TIFR
    extern void serialEventRun(void) __attribute__((weak));
    
    // -----------------------------------------------------------------------------
    // Configuration
    // -----------------------------------------------------------------------------
    
    // Disable features for reduzing memory footprint
    #define MY_SPLASH_SCREEN_DISABLED
    #define MY_DISABLE_RAM_ROUTING_TABLE_FEATURE
    #define MY_DISABLED_SERIAL
    
    #define MY_NODE_ID          0 
    #define MY_PASSIVE_NODE
    #define MY_DISABLE_REMOTE_RESET
    
    // Enable and select radio type attached
    #define MY_RADIO_RF24
    #define MY_RF24_CE_PIN      NOT_A_PIN
    #define MY_RF24_CS_PIN      4
    
    // BME280 settings
    #define BME_CS_PIN          3
    #define TINY_BME280_SPI
    
    // Sleep Time between reads (in milliseconds)
    #define SLEEP_TIME          120000
    
    // -----------------------------------------------------------------------------
    // MySensors
    // -----------------------------------------------------------------------------
    #include <MySensors.h>
    
    #define CHILD_ID_BME_T    1
    #define CHILD_ID_BME_H    2
    #define CHILD_ID_BME_P    3
    #define CHILD_ID_VOLTAGE  4
    
    MyMessage bmeTempMsg(CHILD_ID_BME_T, V_TEMP);
    MyMessage bmeHumMsg(CHILD_ID_BME_H, V_HUM);
    MyMessage bmePressMsg(CHILD_ID_BME_P, V_PRESSURE);
    MyMessage voltageMsg(CHILD_ID_VOLTAGE, V_VOLTAGE);
    
    // -----------------------------------------------------------------------------
    // BME 280
    // -----------------------------------------------------------------------------
    #define TINY_BME280_SPI_CLOCK   1000000 // 1 MHz
    #include <TinyBME280.h>
    tiny::BME280 bme280;
    
    // -----------------------------------------------------------------------------
    // Implementation
    // -----------------------------------------------------------------------------
    void setupSensor()
    {
    
      bme280.beginSPI(BME_CS_PIN);
    
      // read once to erase initial values
      delay(10);
      bme280.setMode(tiny::Mode::FORCED);
    }
    
    void readAndSendSensorValues()
    {
      bme280.setMode(tiny::Mode::FORCED);
    
      delay(8);
      while(bme280.isMeasuring())
        delay(2); //Hang out while sensor completes the reading
    
      send(bmeTempMsg.set(bme280.readFixedTempC()));
      send(bmeHumMsg.set(bme280.readFixedHumidity()));
      send(bmePressMsg.set(bme280.readFixedPressure()));
    }
    
    void readAndSendBatteryVoltage()
    {
      send(voltageMsg.set(hwCPUVoltage()));
    }
    
    // -----------------------------------------------------------------------------
    // Framework Funktions
    // -----------------------------------------------------------------------------
    void setup()
    {
      setupSensor();
    }
    
    void presentation()
    {
      // Send the sketch version information to the gateway and Controller
      sendSketchInfo("ATtiny Sensor", "1.0");
    
      // Register all sensors to gateway (they will be created as child devices)
      present(CHILD_ID_BME_T, S_TEMP);
      present(CHILD_ID_BME_H, S_HUM);
      present(CHILD_ID_BME_P, S_BARO);
      present(CHILD_ID_VOLTAGE, S_MULTIMETER);
    }
    
    void loop()
    {
      readAndSendSensorValues();
      readAndSendBatteryVoltage();
    
      sleep(SLEEP_TIME);
    }
    
    // -----------------------------------------------------------------------------
    

    Don't forget to set your MY_NODE_ID appropriatly.
    BME values are sent as fixed point values and are converted to float on controller side.

    My Project

  • TinyBME - ATTiny85 + NRF24l01 + BME280/I2C
    fabyteF fabyte

    Great achievement, congratulations :+1: :)

    I like that you also tried Nerd Ralph's 3-Pin configuration and got it to work. I tried it once but somehow it didn't connect to the radio, so discarded this idea. Also I thought it might be cheaper (from a memory point of view), just to use one bus. Nice work on stuffing all this in 8K :)

    It would be great if you reported in a couple of weeks how stable it's running. Did you have a chance to measure the power consumption of the hole system?

    My Project

  • A tiny BME node - BME280 on ATtiny85
    fabyteF fabyte

    @pjeran said in A tiny BME node - BME280 on ATtiny85:

    Has there been any thought with integrating these cores into the mySensors family?

    I've opened an issue for Attiny support on Github but there is no reply yet.

    My Project

  • A tiny BME node - BME280 on ATtiny85
    fabyteF fabyte

    When I started this project I had one priority in mind: Keeping it as minimalistic (and small) as possible.
    This is why the design uses standard preassembled modules and a tiny ( ;) ) microprocessor. I also wanted to proof that it is possible to run the MySensors platform on the ATtiny MCU since the hardware requirements are not extraordinary. Minimalistic also means for me that I want to exhaust the given MCU capabilities and build as much as possible. This projects shows that these limited MCU is sufficient enough to work as MySensors node.
    (The BME280 library is quite 'big' regarding the memory footprint. Using sensors with one-wire or just reacting to an interrupt requires even less memory and fits perfectly into 8K).

    Next step is of course improving the dimensions of this sensor node. This is where it goes to working with SMD components and not THT anymore. Unfortunatly my SMD soldering capabilities are limited so I think I won't be able to solder the QFN package by hand so either I order my PCB design preassembled (could be quite expensive, does anyone know?) or I use standard modules and design a 'motherboard' to connect it with the rest of the components (which makes it bigger again).

    I like the NRF5 series, but it also comes with more complexity of the hardware design (antenna matching components and so on) which is too much for me right now. But I also think the final and perfect solution would be something like Raybeacon: nRF52 on-the-go Development Kit.

    Right now, I'm going small steps. 2 months back (or so) I assembled the improved version so that the PCB antenna is free from disturbances:
    2.png 1.png
    Next step will be a design with ATtiny in the SMD package (already ordered, as well as a couple of MLCCs in 1206 and 1210 :) )

    My Project

  • NRF24+ Module: Spontaneous 5A heating mode?
    fabyteF fabyte

    I also experienced this in a breadboard setup with jumper wires. After reconnecting the power supply, the nrf cooled down to normal temperature and still worked. I thought that the reason was cheap nrf modules but the same module didn't have issues in other setups. Unfortunately I never got behind the reason of this problem, but it was always in breadboard setup with external power supply (no batteries). Also it was not reproducable and occurred sporadically.

    Troubleshooting nrf24l01+

  • Is it worth it adding a reset circuit to MySensors nodes?
    fabyteF fabyte

    Try to perform a system reset, not only a MCU reset. If only the MCU is reset, initializing the radio may fail (because it's in an undefined state) and the node does not start.

    Happened to me a few times with a nrf24 radio, I don't know how the RFM69 will behave.

    Hardware

  • can't remove unused sensors from HA
    fabyteF fabyte

    @Jake-Wills I believe you have a persistence file configured for the MySensors configuration?

    For me, the following steps worked:

    1. Stop home assistant/ HassIO
    2. Locate the persistence_file entry in your configuration.yaml
    3. Open this file and identity the entries you want to delete. Remove them from the file and save.
    4. I also cleaned up my database. It should be located under the HA/HassIO config directory and named .homeassistant/home-assistant_v2.db. Open it with sqlite3 and delete all entries from the states table of sensors you deleted. It might be you don't need to do this step but I'm not sure. If you're unfamiliar with databases, just skip this step and try out what happens.
    5. Start home assistant / HassIO
    Home Assistant

  • A tiny BME node - BME280 on ATtiny85
    fabyteF fabyte

    Thanks for this detailed explanation, I will keep that in mind for the next design and plan with capacitors. Currently I have no connectivity troubles in my home (ground floor flat with garden) both inside and outside, but we will see what the situation will be at the end of battery life (PA level high).

    I like your project, BTW, a lot of information and experience documented👍

    My Project

  • A tiny BME node - BME280 on ATtiny85
    fabyteF fabyte

    @Nca78 You are right, I mixed those numbers up with another project running on a 9V battery. The correct values are:
    ~ 7uA in power down state, ~25mA in transmit, which gives 20uA as mean and with 200mAh about 1 year (+).

    I'm running the devices without capacitor. Would you advice to use them because it is better for battery health reasons? Because currently I don't see any negative impact, the battery seems fine with the current draw.

    My Project

  • A tiny BME node - BME280 on ATtiny85
    fabyteF fabyte

    @BearWithBeard
    I had the same problem and was also very confused :)

    All of the 6-pin (and more) BME modules are designed to work operating in I2C mode per default. For this, several pull-up resistors are soldered on the modules. I found out that in SPI mode, the hole module is working although VCC is not connected. The pull-up on the CSn line caused a current leakage and thus the module had a 'very' high current consumption. I removed all resistors on the module (all 4 on MISO/MOSI/CSn/CLK - SPI doesn't need pull-up resistors) and the consumption was as expected (<= 1 uA, more or less, I don't have the right equipment at home for more resolution).

    I don't know which version of the BME 280 modules you have. I ordered several kinds and regarding sensor quality and size I settled with these 6-pin "red" PCB:
    2.jpg1.jpg
    As you can see, I desoldered the SMD resistors.

    Hope this helps :) I know the struggle to get the right BME280 module. I also paid about 2,70 Euro including shipping from China to Germany. Never found module more cheap. If they cost less than 2 Euro, then it's definitely a BMP :)

    My Project
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular