Home assistant, localtuya, and Petoneer Nutri Mini

I can confirm that the Petoneer Nutri Mini (a.k.a. Pettadore Nutri Fresh) can be controlled via the local Wi-Fi by Home Assistant. This can be achieved using the localtuya integration, which means that you have no dependency on the cloud.

Steps:

  1. Setup your device with the Tuya IoT cloud in order to get the required API tokens that you need. All these steps are well described in the tuyaapi documentation.
  2. Add localtuya to your installation, for example via the HACS approach (as it’s not in the main integrations repository).
  3. Once you setup localtuya, it will find devices on your network. If you have the IoT in a different VLAN, you might need to directly provide the device’s IP address to localtuya.
  4. Localtuya will interrogate your Nutri Mini for its capabilities. It is important that you don’t have other tools (like a tuya-cli) with an open connection to your device (it supports only one connection at a time).
  5. Then the important part: which property IDs map to which device function? I didn’t enumerate them all, as for me the ‘express feeding’ capability was the only one of interest. For example, 103 is the device beep when feeding. However, the important one is ID 3, which controls express feeding. Use device type switch.
  6. Once you’ve added this ID (3) to Home Assistant, you will see a toggle (boolean) entity being added. If you switch this toggle from off to on, it will dispense food.
  7. Since the toggle is by default on true, it takes two steps to dispense (on->off, off->on). I’ve not tried to deep-dive if this can be changed, but simply created a script:
- express_feeding:
    mode: queued
    max: 10
    sequence:
      - service: switch.turn_off
        target:
          entity_id: switch.feeder
      - service: switch.turn_on
        target:
          entity_id: switch.feeder
      - delay: 3

Now you can call this script in your automations to dispense food at conditions such as pets being indoors, specific times, etc.

Update fall 2022: I found that DPS 14 is for whether the device is empty.

Switching on IPMI devices using Home Assistant

One of the systems on my home network can be switched on/off using IPMI. Since Home Assistant is running 24/7, it would be useful to be able to power toggle this system straight from Home Assistant.

There is currently no add-on or integration that can perform this task. In the meantime, the following hack provides a workaround.

configuration.yaml

shell_command:
  ipmi_install_and_trigger: "which ipmitool >/dev/null 2>&1 || (apk update && apk add ipmitool); ipmitool -H <INTERNAL_IP_ADDRESS> -U admin -P <PASSWORD> chassis power on"

Lovelace

[...]
    cards:
[...]
      - name: 'install ipmitool and trigger <SERVER_NAME>'
        type: button
        tap_action:
          action: call-service
          service: shell_command.ipmi_install_and_trigger
        show_icon: true
        show_name: true

You can install this lovelace card in your existing dashboard by using the raw configuration editor and pasting the above in the respective section.

Fixing Wi-Fi connection issue Honeywell Evohome with Ubiquiti UniFi access point

I found that my Honeywell Evohome thermostat would not properly connect to my (IoT) Wi-Fi SSID. Looking in the logs of the UniFi controller, it appeared that the thermostat was ignoring the DHCPOFFER it received from the DHCP server in the controller. The thermostat interface indeed showed that it could not get an IP address.

The solution that worked for me was to disable the BSS Transition option in the UniFi controller:

(Note that I earlier already disabled 5Ghz and enabled legacy support for this SSID. These settings might help as well, but were not the solution in this case.)

After this BSS Transition change, the thermostat was able to connect immediately. I confirmed that from two otherwise identical SSIDs, the thermostat could only connect to the one with BSS Transition disabled.

Workaround for Microsoft Teams freezing when joining a call

I ran into the issue that Microsoft Teams was freezing when joining a call (Windows 10).

The place to check the Teams logfile is %APPDATA%\Microsoft\Teams\logs.txt. In my case, just before the freezing occurred, the following line was visible:

Mon Mar 08 2021 15:46:12 GMT+0100 (Central European Standard Time) <32256> -- info -- BluetoothLE Desktop: ble:burst-scan requested

In my case, therefore, the fix was to disable Bluetooth on my Windows machine. This is not ideal and there might be better ways. However, in my case I wasn’t using Bluetooth because my headset is connected via the vendor’s Bluetooth dongle.

Blinds with Home Assistant (part two)

In the previous post, we saw how you can use Node-RED to control RF 433Mhz roller blinds via Home Assistant using a Broadlink unit.

The next step is to make it properly clickable from the Lovelace UI, without having to open a Node-RED UI.

The first step is to created an template (emulated) cover entity. In this example, I generate two entities for blinds operating on two different channels (in file configuration.yaml):

cover:
  - platform: template
    covers:
      roller_blinds_chan1:
        device_class: blind
        friendly_name: "Roller blinds (Bedroom)"
        unique_id: "roller_blinds_chan1"
        position_template: 50
        open_cover:
          service: script.open_roller_blinds_chan1
        close_cover:
          service: script.close_roller_blinds_chan1
        stop_cover:
          service: script.stop_roller_blinds_chan1
          
      roller_blinds_chan2:
        device_class: blind
        friendly_name: "Roller blinds (Office)"
        unique_id: "roller_blinds_chan2"
        position_template: 50
        open_cover:
          service: script.open_roller_blinds_chan2
        close_cover:
          service: script.close_roller_blinds_chan2
        stop_cover:
          service: script.stop_roller_blinds_chan2

NB: since these roller blinds don’t provide open/closed feedback (it’s one-way communication), we use position_template: 50 to tell Home Assistant that the blind is always halfway, which means that open/close/stop buttons are always available to be pressed. Furthermore, by using unique_id, your entity will be added to the registry in Home Assistant so that you can (among other things) add it to an area.

Next, create dummy scripts for these service calls (inspiration taken from Bonanitech) in file scripts.yaml:

- open_roller_blinds_chan1:
    sequence:
- close_roller_blinds_chan1:
    sequence:
- stop_roller_blinds_chan1:
    sequence:
- open_roller_blinds_chan2:
    sequence:
- close_roller_blinds_chan2:
    sequence:
- stop_roller_blinds_chan2:
    sequence:

Now you should have roller blinds in your Lovelace that you can click but will not do anything at the moment.

Following Bonanitech’s example, we will now change our Node-RED flow to listen to these events. I had to tweak it a little bit in order to get it working, so my approach differs slightly.

The node on the top-left is an “events: all” node. Its Event Type is “call_service” (this is unchanged from Bonanitech’s example). The first switch in the flow checks on the property payload.event.service_data.entity_id and matches the condition cover.roller_blinds_chan1:

This check, however, does not yet tell us what operation was executed. For that we need to check a different field; the next switch checks property payload.event.service and has as first condition close_cover and as second condition open_cover:

This should already be enough to get you a working setup.

There is one more (unrelated) change I made since my previous post. Sometimes the RF signal doesn’t come through to the blinds the first time. Therefore, I’ve made use of the “looptimer” node to send the RF commands a couple of times in quick succession to make sure at least one signal comes through. The looptimer is the “2 Second Loop” node that you see in the above Node-RED screenshot. The self-explanatory properties I’ve configured are: