Navigation

    • Register
    • Login
    • Search
    • OpenHardware.io
    • Categories
    • Recent
    • Tags
    • Popular
    1. Home
    2. martinhjelmare
    • Profile
    • Following
    • Followers
    • Topics
    • Posts
    • Best
    • Groups

    martinhjelmare

    @martinhjelmare

    Plugin Developer

    144
    Reputation
    632
    Posts
    2299
    Profile views
    5
    Followers
    0
    Following
    Joined Last Online

    martinhjelmare Follow
    Plugin Developer

    Best posts made by martinhjelmare

    • Box for in wall pcb

      I'd like to have a box for in wall PCBs with exposed AC circuitry, due to safety concerns. Since space is very restricted I've started on a custom box design for 3d printing. If you have seen commercial samples that fit the criteria, feel free to add links/images here. Also if you want to add your own custom designs, please contribute.

      My design goals:
      Should fit inside a Swedish standard wall box behind the (lamp) switch. Diameter < 65 mm, depth < 30 mm.
      Should hold pcb project by @sundberg84 : http://forum.mysensors.org/topic/2488/in-wall-pcb

      Other in-wall-pcb box projects:

      • UK slimline wall box, depth < 25 mm.
        http://forum.mysensors.org/topic/2511/in-wall-light-switch-node-custom-pcb

      My first WIP design attempt (I'm new to CAD design):

      pcb_wall_box.stl

      pcb_wall_box_cropped.png

      posted in Hardware
      martinhjelmare
      martinhjelmare
    • RE: OTA firmware updating is too slow..

      I implemented a check for firmware update message in my modified SenseBenderMicro sketch, and alternative behavior in the loop if FW update is ongoing. This doesn't solve the problem of dropped messages, but could be good to speed up the update and don't waste time on sensor updates.

      void loop() {
        if (fwUpdateOngoing) {
          fwUpdateOngoing = false;
          fwUpdateOngoing = wait(OTA_WAIT_PERIOD, C_STREAM, ST_FIRMWARE_RESPONSE);
        } else {
          normalFlow();
        }
      }
      
      void normalFlow() {
        // Short delay to allow buttons to properly settle
        sleep(5);
      
        int buttonValue = digitalRead(BUTTON_PIN);
      
        measureCount ++;
        sendBattery ++;
        bool forceTransmit = false;
        transmission_occured = false;
      #ifndef MY_OTA_FIRMWARE_FEATURE
        if ((measureCount == 5) && highfreq)
        {
          clock_prescale_set(clock_div_8); // Switch to 1Mhz for the reminder of the sketch, save power.
          highfreq = false;
        }
      #endif
      
        if (measureCount > FORCE_TRANSMIT_INTERVAL) { // force a transmission
          forceTransmit = true;
          measureCount = 0;
        }
      
        sendTempHumidityMeasurements(forceTransmit);
        if (buttonValue != oldValue) {
           // Send in the new buttonValue
           send(msg.set(buttonValue==HIGH ? 0 : 1));
           oldValue = buttonValue;
           transmission_occured = true;
        }
      
      #ifdef MY_OTA_FIRMWARE_FEATURE
        if (transmission_occured) {
          fwUpdateOngoing = wait(OTA_WAIT_PERIOD, C_STREAM, ST_FIRMWARE_RESPONSE);
        }
      #endif
      
        sleep(digitalPinToInterrupt(BUTTON_PIN), CHANGE, MEASURE_INTERVAL);
      }
      
      posted in Bug Reports
      martinhjelmare
      martinhjelmare
    • RE: 💬 Sensebender Micro

      I've tested to upload a sketch to the Sensebender Micro using platformio.

      Put the following JSON into a json file in a folder named boards either in the MySensors library folder (your project in platformio), or somewhere else on the search path. Use the name of the json file in platformio.ini in the board setting. See for more info:
      http://docs.platformio.org/en/latest/platforms/creating_board.html

      • Create a folder named boards in MySensors project folder.
      • Create a file in boards named sensebendermicro8MHz.json.
      {
        "build": {
          "core": "arduino",
          "extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_PRO",
          "f_cpu": "8000000L",
          "mcu": "atmega328p",
          "variant": "standard"
        },
        "frameworks": [
          "arduino"
        ],
        "fuses": {
          "efuse": "0x06",
          "hfuse": "0xD2",
          "lfuse": "0xE2",
          "lock": "0x3F"
        },
        "name": "Sensebender Micro (3.3V, 8 MHz)",
        "upload": {
          "maximum_ram_size": 2048,
          "maximum_size": 30720,
          "protocol": "arduino",
          "require_upload_port": true,
          "speed": 57600
        },
        "url": "https://github.com/mysensors/SensebenderMicro",
        "vendor": "MySensors"
      }
      
      • Add an env in platformio.ini.
      [env:sensebendermicro8MHz]
      platform = atmelavr
      framework = arduino
      board = sensebendermicro8MHz
      lib_deps = MySensors
      
      • Compile sketch.
      • Upload sketch.

      I think I've got the settings correct, but it was the first time I did this. But it's tested and works as far as I can see.

      Should we add a JSON file to one of the mysensors repos on github?

      posted in OpenHardware.io
      martinhjelmare
      martinhjelmare
    • RE: Method to OTA a sleeping node

      Home assistant also supports smartsleep.

      posted in Development
      martinhjelmare
      martinhjelmare
    • Home Assistant v 0.12

      Version 0.12 of home assistant is now released. The mysensors component has seen three bugfixes and two refactors. This includes:

      • Fix error in unit_of_measurement, by adding version check. Both version 1.4 and 1.5 should now work.
      • Fix adding devices on the fly, without restart and without persistence enabled.

      I've also added information to the documentation at https://home-assistant.io/components/mysensors/. There's now a step by step instruction how to present your sensors and actuators to home assistant. You can also see exactly which S_TYPES and V_TYPES are supported by the sensor and switch platforms.

      All feedback, problem reports and suggestions are very welcome and appreciated. For example, the two mentioned bugs above were found by the community.

      Looking ahead, I'm working on making the serial connection more stable, an ethernet gateway, a light platform, and adding feedback state to the actuator platforms. I'm also planning to add support for value requests and acknowledgements.

      posted in Home Assistant
      martinhjelmare
      martinhjelmare
    • RE: Pooling battery relay

      Yes, smartsleep is supported. I explained how that is implemented in this post:
      https://forum.mysensors.org/topic/5440/heartbeats/3

      posted in Home Assistant
      martinhjelmare
      martinhjelmare
    • RE: Pooling battery relay

      @abmantis

      I didn't make the initial mysensors implementation in home assistant that only supported sensors, but I made the refactor that laid the groundwork for multiple mysensors platforms in home assistant. About 5-10 people has been contributing to the mysensors component in home assistant over time.

      There's also the pymysensors package (not my creation either) that interfaces mysensors and home assistant. It's actually this package that holds most of the mysensors specific logic, like smartSleep. Here there's also about 5-10 people that has contributed.

      All help and feedback is welcome!

      posted in Home Assistant
      martinhjelmare
      martinhjelmare
    • RE: Request for contribution - controller selection matrix

      @AWI

      I've added Home Assistant in google drive sheet.

      posted in Controllers
      martinhjelmare
      martinhjelmare
    • RE: Interrupt, Perform a specific function, not the loop

      @vickey

      The sleep function with single interrupt returns true if woken by the interrupt and false if woken by the timer. Sleeping with two interrupts returns the number of the interrupt pin that wakes it or negative if timer wakes. See the API.

      I would check the return value of the sleep function and divide the loop into at least two functions. One is run if interrupt wakes it, the other is run after timer wake up.

      edit

      Note that it's the interrupt number and not the pin number of the interrupt, that is returned for the two pin interrupt sleep function, according to the API.
      http://www.mysensors.org/download/sensor_api_15#the-full-api

      posted in General Discussion
      martinhjelmare
      martinhjelmare
    • Home Assistant v 0.11.1 with switch support

      Hi!

      Version 0.11 of home assisstant is now released with included mysensors switch support for serial gateway. Right now switches will change state optimistically, without waiting for reply from actuator. I'll add support for feedback state soon. Let me know of any problems.

      I've also refactored the component so it will be easy to add new platforms, light, binary sensor, lock etc. I'm hoping to have time to do so soon. Another new feature is multiple serial gateways connected at the same time.

      Edit:

      You have to update your config if already using mysensors in home assistant. It should now look like this, for two gateways:

      mysensors:
        gateways:
          - port: '/dev/ttyUSB0'
            persistence_file: 'path/mysensors.json'
          - port: '/dev/ttyACM1'
            persistence_file: 'path/mysensors2.json'
        debug: true
        persistence: true
        version: '1.5'
      

      You can see that it's not a sensor platform config anymore. The available platforms will be setup automatically from the component.

      Update: Bugfix release 0.11.1 is now released. Version 0.11 was missing the binary sensors. That has now been fixed in 0.11.1.

      posted in Home Assistant
      martinhjelmare
      martinhjelmare

    Latest posts made by martinhjelmare

    • RE: Use battery_level to create an entity with a dynamic icon (avoid templates and save airspace noise!)

      I think it's a good idea.

      My todo list for mysensors is already very long and I have limited time, though, so I don't think I will code this up soon. It shouldn't be very difficult though, so anyone is welcome to have a go and make a pull request. I'll happily review.

      posted in Home Assistant
      martinhjelmare
      martinhjelmare
    • RE: Presenting to HA over ethernet

      @tdecurtins

      https://www.home-assistant.io/components/mysensors/#presentation

      Home assistant only supports ethernet gateways that act as servers. So home assistant will connect as the client, ie we only configure the gateway address in home assistant, not the other way around.

      posted in Home Assistant
      martinhjelmare
      martinhjelmare
    • RE: Move To HASS MQTT - Nodes not responding

      @soloam

      If you changed the optimistic setting, actuators will have assumed state and this will show in the ui as two different buttons for on and off.

      I recommend to not use optimistic setting, but instead feedback the new state to home assistant.

      posted in Home Assistant
      martinhjelmare
      martinhjelmare
    • RE: Move To HASS MQTT - Nodes not responding

      @soloam

      You need to send/feedback the new state to home assistant from the node in the receive function. Otherwise home assistant thinks the message was not received by the node. This behavior is modified by the optimistic setting in the mysensors config section.

      posted in Home Assistant
      martinhjelmare
      martinhjelmare
    • RE: Problem with sketch IRSender/Receiver (A/C control)

      @luglio

      V_IR_RECORD isn't yet supported by home assistant.

      posted in Home Assistant
      martinhjelmare
      martinhjelmare
    • RE: Adding a sensor to the configuration file

      @kobipes

      I think you will get the best help regarding USB exposure in Hass.io in the Hass.io section of the home assistant community forum.

      I'm using hassbian.

      posted in Home Assistant
      martinhjelmare
      martinhjelmare
    • RE: Adding a sensor to the configuration file

      @kobipes

      Are you using Hass.io?

      The config validation when using Hass.io doesn't seem reliable.

      I've never used Hass.io so I can't really help you better than this. You can try to search this forum and the home assistant forum for similar questions.

      posted in Home Assistant
      martinhjelmare
      martinhjelmare
    • RE: Adding a sensor to the configuration file

      Have you read about the mysensors network?
      https://www.mysensors.org/about/network

      You need to have basic knowledge of the different parts of a mysensors network before you start configuring the controller.

      You should also read about the different gateway options.

      https://www.mysensors.org/build/select_gateway

      If you know the different parts of the network you will more easily understand how to configure the controller.

      posted in Home Assistant
      martinhjelmare
      martinhjelmare
    • RE: Sensor naming problem

      This is on my todo list. I hope to get to it soon.

      posted in Home Assistant
      martinhjelmare
      martinhjelmare
    • RE: Arduino USB gateway for relay with buttons

      You need to feedback the state change to home assistant by sending the new state from the receive function after the calls to digitalWrite and saveState.

      posted in Home Assistant
      martinhjelmare
      martinhjelmare