esphome-nibe icon indicating copy to clipboard operation
esphome-nibe copied to clipboard

Fake RMU40 room temperature sensor

Open egisz opened this issue 1 year ago • 4 comments

I managed to fake RMU40 temperature sensor. Created branch in my repo, [fake-rmu-sensor] (https://github.com/elupus/esphome-nibe/compare/master...egisz:fake-rmu-sensor?expand=1) branch

  • Added ~~number template~~ home asssistant sensor entity rmu40_fake_temp in esp config file:
# Home Assistant Sensor - https://esphome.io/components/sensor/homeassistant.html
# used to map any HA temperature sensor to pretend as RMU40 room temperature sensor.
# sensor id must be passed to nibegw component
sensor:
  - platform: homeassistant
    id: rmu40_fake_temp
    entity_id: sensor.shellyplusht_08b61fcad31c_temperature # replace to your sensorId
# Configure NibeGW
nibegw:
  udp:
    target:
        ...
  rmu40_fake_temp_sensor_id: rmu40_fake_temp
  • Updated NibeGwComponent::callback_msg_token_received function to insert fake sensor's value instead of constant value.

Thats it, now I can control RMU40 sensor from HA ~~both manually adjusting sensor, or by simple automation which triggers on my~~ automatically on each Shelly H&T temperature change.

image

egisz avatar Nov 08 '23 09:11 egisz

Yup, this is close to how i thought to do it. But needs to be a bit more generalised.

elupus avatar Nov 08 '23 11:11 elupus

The 7 offset is strange but known: https://github.com/yozik04/nibe/blob/2278e2e2f71d6078440ecf239eb76b6ce53199fd/nibe/connection/nibegw.py#L691

elupus avatar Nov 08 '23 11:11 elupus

Yup, this is close to how i thought to do it. But needs to be a bit more generalised.

Yes, this is only proof of concept that it actually works. I have an idea how to generalise - add new nibegw config category sensors and put sensors there with same matching to address, token, etc:

nibegw:
   <...>
  remote_sensors:
   - address: RMU40_S1
     token: RMU_WRITE
     id: sensor.shellyplusht_08b61fcad31c_temperature # HA sensor id

  # Constant replies to certain requests can be made
  constants:
    - address: MODBUS40
      token: ACCESSORY
      data: [
            0x0A, # MODBUS version low
            0x00, # MODBUS version high
            0x02, # MODBUS address?
      ]

And then auto generate those sensors automatically with cg. Maybe there will be similar need to implement some other sensor, as humidity as AFAIK Nibe has such. Let me know what you think

egisz avatar Nov 08 '23 14:11 egisz

I've made an attempt at this too: https://github.com/elupus/esphome-nibe/pull/60 it's getting there :). Set points works too.

elupus avatar Dec 10 '23 03:12 elupus

I've merged an alternate solution now. Seem to work mostly, very little tests.

elupus avatar Aug 24 '24 19:08 elupus