zxdavb / ramses_cc

HA integration for CH/DHW and HVAC systems that use the RAMSES II RF protocol
GNU General Public License v3.0
80 stars 17 forks source link

Adding 1FC9 binding messages to ramses_cc_message HA events #151

Closed Onl1ne1373 closed 9 months ago

Onl1ne1373 commented 9 months ago

I created a Home Assistant Blueprint for handling Spider messages. It would be better if Spider Thermostat was fully supported in ramses_rf, but for now it works for me.

Blueprint: https://raw.githubusercontent.com/Onl1ne1373/home-assistant-blueprints/main/spider.yaml

What this blueprint does is that it listens to 01FF and 1FC9 messages and handles auto binding and RP messages. It also listens to a HA Generic Thermostat for the setpoint.

Setpoint messages work if I change the parser like in ramses_rf issue: https://github.com/zxdavb/ramses_rf/issues/101 The 1FC9 message do not work because I do not receive these messages via ramses_cc_message event. It would be very handy if I could receive them. I don't think it is a parser issue, but more a handling one.

I use message_events: "RQ.* (01FF|1FC9)"

I will look further into it, but it would be very nice if you could add 1FC9 binding messages also to ramses_cc_message events.

zxdavb commented 9 months ago

I woudl use:

ramses_cc:
  advanced_features:
    message_events: "RQ.* (01FF|1FC9) "

Note the space after 1FC9)

zxdavb commented 9 months ago
>>> regex
re.compile('I.* (000A|0418|1F09|1FC9) ')

>>> regex.match(" I --- 03:183434 --:------ 63:262142 1FC9 018 0023090ECC8A0030C90ECC8A0000080ECC8A")

>>> regex.match("I 1FC9 ")
<re.Match object; span=(0, 7), match='I 1FC9 '>

>>> regex.match(" I 1FC9 ")

>>> regex.search(" I 1FC9 ")
<re.Match object; span=(1, 8), match='I 1FC9 '>

The code has this:

        ) and regex.match(f"{msg!r}"):

... and it should be:

        ) and regex.search(f"{msg!r}"):
zxdavb commented 9 months ago

@Onl1ne1373

An RQ|1FC9 is unusual. Did you intend to listen for I|1FC9 (or W|1FC9), or 1F09?

Or can you provide more information?

Perhaps you meant: "(RQ.* 01FF |I.* 1FC9)"

Onl1ne1373 commented 9 months ago

Sorry I changed it, it was "(I|RP).* (01FF|1FC9)". The extra space is nice after the message type, that way the start of payload does not match.

But indeed, RQ of 01FF and I for the 1FC9. So "(RQ.* 01FF |I.* 1FC9 )" would be much better!

Onl1ne1373 commented 9 months ago

Changed it to "(RQ.* 01FF |I.* 1FC9 )", but I do not get I|1FC9 events in Home Assistant. I do get the RQ|01FF. Using the development tools.

2024-02-04T16:53:50.019116 076  I --- 21:033394 --:------ 21:033394 1FC9 030 0022C95482720022F154827200000E5482720110E0548272001FC9548272
Onl1ne1373 commented 9 months ago

Changed regex.match to regex.search in init.py and it works, I get the events! Thank you!

I debugged my HA blueprint and automatic binding for Spiders is working!

zxdavb commented 9 months ago

Simply use this for now: "(RQ.* 01FF | I.* 1FC9 )"