fustom / ariston-remotethermo-home-assistant-v3

Ariston NET remotethermo integration for Home Assistant based on API
MIT License
147 stars 37 forks source link

All entities unavailable. #332

Closed Patbonamy closed 3 months ago

Patbonamy commented 4 months ago

First of all please check my wikipage: https://github.com/fustom/ariston-remotethermo-home-assistant-v3/wiki and the previous issues (included the closed ones) before you create a new one.

**Describe the bug" I want to reopen this one https://github.com/fustom/ariston-remotethermo-home-assistant-v3/issues/331

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Environment (please complete the following information):

Additional context, debug log How can we do?

darksider4all commented 3 months ago

https://github.com/fustom/broker-ari/tree/support_lydos_hybrid

I just gave it a try; the features I tested were working correctly. I'll wait a bit more for some additional userbase before I switch to using it permanently :)

Hello irsl, Can you tell us a detailed explanation of how you have implemented your solution, because many of us are noobs. I try myself but I am lost. Thanks in advance

The link won't work

I would also like a guide on this

hipco commented 2 months ago

https://github.com/fustom/broker-ari

Can confirm that the fork from fustom works very well with my Velis Evo 2. Some rough information about my implementation on Gentoo.

Local Server and Network Gateway 10.10.10.1 Velis Evo 2 Mac ac:67:b2:xx:xx:xx

Init Script

!/sbin/openrc-run

description="Ariston MQTT Broker" command="/somepath/ariston/broker-ari" command_user="${RC_SVCNAME}:${RC_SVCNAME}" directory="/somepath/ariston" command_background=yes pidfile=/run/${RC_SVCNAME}.pid

Iptables Appropriate Incoming/outgoing rules (123/2080/5300/8883) and DNAT rules iptables -t nat -A PREROUTING -i br0 -p udp -m mac --mac-source ac:67:b2:xx:xx:xx --dport domain -j DNAT --to 10.10.10.1:5300 iptables -t nat -A PREROUTING -i br0 -p tcp -m mac --mac-source ac:67:b2:xx:xx:xx --dport 8883 -j DNAT --to 10.10.10.1:8883

homeassistant core.config_entries "username": "someusername", "password": "somepassword", "api_url_setting": "http://10.10.10.1:2080/",

broker-ari { "Api_debug": false, "Api_listener": "10.10.10.1:2080", "Api_password": "somepassword", "Api_username": "someusername", "Dns_listener": "10.10.10.1:5300", "Dns_resolve_to": "10.10.10.1", "Ntp_resolve_to": "162.159.200.1", "Mqtt_broker_certificate_path": "/somepath/ariston/config/server.pem", "Mqtt_broker_clear_listener": "", "Mqtt_broker_private_key_path": "/somepath/ariston/config/server.key", "Mqtt_broker_tls_listener": "10.10.10.1:8883", "Mqtt_proxy_upstream": "ssl://broker-ari.everyware-cloud.com:8883", "Poll_frequency": 60, "Consumption_poll_frequency": 600, "Devices": [ { "GwID": "AC67B2XXXXXX", "Sys": 4, "WheType": 6, "WheModelType": 4, "Name": "", "ConsumptionTyp": "2", "ConsumptionOffset": 0 }, { "GwID": "", "Sys": 4, "WheType": 2, "Name": "", "ConsumptionTyp": "7,8", "ConsumptionOffset": 1 } ] }

domenicoblanco commented 2 months ago

Hi! I just tried with a Nimbus (an heat pump that should be similar to the Galevo) and I wasn't able to set it up. The DNS should be fine, a nslookup on my laptop works well and resetted the network settings in order to set a static DNS, but the logs and the topics aren't logging anything useful and the integration in HASS says that wasn't able to find devices.

Finally, I wasn't sure about the parameters at the end of the config file:

{
    "GwID": "1C9XXXXXXXXX",
    "Sys": 3,
    "WheType": -1,
    "WheModelType": -1,
    "Name": "",
    "ConsumptionTyp": "1,3",
    "ConsumptionOffset": 0
 }

Probably this isn't supported in the fustom's fork, but I hoped to find anyway something useful inside the available topics

Patbonamy commented 2 months ago

Nobody can make a guide for the broker for noobs? Please help us.

domenicoblanco commented 2 months ago

Nobody can make a guide for the broker for noobs? Please help us.

In a few steps:

You should also reset your appliance and set a static address instead of DHCP, making sure to set the DNS to the machine's IP in which is running broker-ari

Patbonamy commented 2 months ago

Nobody can make a guide for the broker for noobs? Please help us.

In a few steps:

  • Clone the repository or download it
  • Open a terminal and change the folder inside the broker-ari folder
  • Install Go, minimum version 1.21
  • Run inside your terminal these two commands go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.28 and go install -v github.com/go-delve/delve/cmd/dlv@latest
  • Run CGO_ENABLED=0 go build -v -o broker-ari
  • Create the SSL certs with openssl (make sure to have it installed)
openssl req -nodes -x509 -sha256 -newkey rsa:2048 \
  -keyout  broker-ari.everyware-cloud.com.key \
  -out  broker-ari.everyware-cloud.com.crt \
  -days 356 \
  -subj "/C=NL/ST=Zuid Holland/L=Rotterdam/O=ACME Corp/OU=IT Dept/CN=broker-ari.everyware-cloud.com"  \
  -addext "subjectAltName = DNS:broker-ari.everyware-cloud.com" 

You should also reset your appliance and set a static address instead of DHCP, making sure to set the DNS to the machine's IP in which is running broker-ari

Thank you [domenicoblanco] I will try

domenicoblanco commented 2 months ago

No problem, feel free to ask if something isn't clear!

Also, if I did something wrong, feel free to correct me c:

domenicoblanco commented 2 months ago

Small update for anyone that's trying something similar: I dug a bit in the logs and noticed that my heat pump is requesting for a different endpoint (connect.iot.remotethermo.com). I was able to receive the requests from the heat pump but I'm unable to resend data into the upstream broker. Because of this I wasn't able to retrieve the parameters of my heat pump

irsl commented 2 months ago

...a different endpoint (connect.iot.remotethermo.com). I was able to receive the requests from the heat pump ...

Just to avoid misunderstandings: you mean you got some MQTT traffic? If so, would you mind sharing the logs?

domenicoblanco commented 2 months ago

When I tried I was able to obtain some messages in the logs like

OnPublish on the local broker by inline: $EDC/ari/mqtt-explorer-76439da9/ar1/GET/Menu/Par, CJOp1Oa63KztF8K4AhAKAlAxEAVCCFRfMTguMC4wwrgCEAoCUDIQBUIIVF8xOC4wLjHCuAIQCgJQMxAFQghUXzE4LjAuMsK4AhAKAlA0EAVCCFRfMTguMC4zwrgCEAoCUDUQBUIIVF8xOC4wLjXCuAIQCgJQNhAFQghUXzE4LjEuMMK4AhAKAlA3EAVCCFRfMTguMS4zwrxOC4zLjDCuAIQCgJQORAFQghUXzE4LjMuMcK4AAhEKA1AxMRAFQghUXzE4LjMuM8K4AhEKA1AxMhAFQghUXzE4LjMuNcK4AhEKA1AxMxAFQghUXzE4LjMuNsK4Ah8KE3JlcXVlc3Rlci5jbGllbnQuaWQQBUIGaW5saW5lwrgCFgoKcmVxdWVzdC5pZBAFQgZwYXJhbXM=
2024/06/20 13:28:18 timestamp:1718882898722231443 params:{key:"P1" something1:5 value_s:"T_18.0.0"} params:{key:"P2" something1:5 value_s:"T_18.0.1"} params:{key:"P3" something1:5 value_s:"T_18.0.2"} params:{key:"P4" something1:5 value_s:"T_18.0.3"} params:{key:"P5" something1:5 value_s:"T_18.0.5"} params:{key:"P6" something1:5 value_s:"T_18.1.0"} params:{key:"P7" something1:5 value_s:"T_18.1.3"} params:{key:"P8" something1:5 value_s:"T_18.3.0"} params:{key:"P9" something1:5 value_s:"T_18.3.1"} params:{key:"P10" something1:5 value_s:"T_18.3.2"} params:{key:"P11" something1:5 value_s:"T_18.3.3"} params:{key:"P12" something1:5 value_s:"T_18.3.5"} params:{key:"P13" something1:5 value_s:"T_18.3.6"} params:{key:"requester.client.id" something1:5 value_s:"inline"} params:{key:"request.id" something1:5 value_s:"params"}

Now I'm noticing that the topic is the one from MQTT Explorer, so either my device isn't using the MQTT broker or is connecting in another way to the official API

Edit: Of course I had to tweak a bit the code in order to not contact the official broker and prevent the use in any case of the client data stored in ClientsMap

Patbonamy commented 2 months ago

Nobody can make a guide for the broker for noobs? Please help us.

In a few steps:

  • Clone the repository or download it
  • Open a terminal and change the folder inside the broker-ari folder
  • Install Go, minimum version 1.21
  • Run inside your terminal these two commands go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.28 and go install -v github.com/go-delve/delve/cmd/dlv@latest
  • Run CGO_ENABLED=0 go build -v -o broker-ari
  • Create the SSL certs with openssl (make sure to have it installed)
openssl req -nodes -x509 -sha256 -newkey rsa:2048 \
  -keyout  broker-ari.everyware-cloud.com.key \
  -out  broker-ari.everyware-cloud.com.crt \
  -days 356 \
  -subj "/C=NL/ST=Zuid Holland/L=Rotterdam/O=ACME Corp/OU=IT Dept/CN=broker-ari.everyware-cloud.com"  \
  -addext "subjectAltName = DNS:broker-ari.everyware-cloud.com" 

You should also reset your appliance and set a static address instead of DHCP, making sure to set the DNS to the machine's IP in which is running broker-ari

I want to install it in a docker container the command wont work: -bash: go: command not found

domenicoblanco commented 2 months ago

I want to install it in a docker container the command wont work: -bash: go: command not found If it's Debian based try with a RUN apt install go@1.21 or RUN apt install golang@1.21

Patbonamy commented 2 months ago

install golang@1.21

Same problem -bash: RUN: command not found

domenicoblanco commented 2 months ago

RUN is only if you use in the Dockerfile, if you’re doing it inside an already running container just remove the initial RUN

irsl commented 2 months ago

Now I'm noticing that the topic is the one from MQTT Explorer, so either my device isn't using the MQTT broker or is connecting in another way to the official API

Edit: Of course I had to tweak a bit the code in order to not contact the official broker and prevent the use in any case of the client data stored in ClientsMap

Just checked, connect.iot.remotethermo.com is listening on port 8883 (just like broker-ari.everyware-cloud.com), so with some luck the protocol won't be entirely different. The Lydos devices do verify the common name/SAN of the certificate, but don't have a trust anchor. Did you try generating a certificate with the hostname your heat pump expects?

domenicoblanco commented 2 months ago

I tried with

openssl req -nodes -x509 -sha256 -newkey rsa:2048 \
  -keyout  broker-ari.everyware-cloud.com.key \
  -out  broker-ari.everyware-cloud.com.crt \
  -days 356 \
  -subj "/C=NL/ST=Zuid Holland/L=Rotterdam/O=ACME Corp/OU=IT Dept/CN=connect.iot.remotethermo.com"  \
  -addext "subjectAltName = DNS:connect.iot.remotethermo.com" 

But I don't know if it's correct and how to check if the heat pump accepts it, anyway there's another problem with the upstream broker as it refuses my credentials

Edit: I just googled and found that openssl has something to see more informations about a remote cert. I'll try to generate a new certificate, hoping to receive at least something in my local broker

Edit 2: Maybe this one could work

openssl req -nodes -x509 -sha256 -newkey rsa:2048 \
  -keyout  broker-ari.everyware-cloud.com.key \
  -out  broker-ari.everyware-cloud.com.crt \
  -days 356 \
  -subj "/C=US/O=Amazon/CN=connect.iot.remotethermo.com"  \
  -addext "subjectAltName = DNS:connect.iot.remotethermo.com"

Edit 3: It didn't as the heat pump was still reachable from remotenet

Edit 4: I tried again with the following cert and I still receive listener=t1s error="read connection: remote error: tls: unknown certificate authority"

openssl genrsa -out private.key 2048 \
&& openssl req -new -key private.key -out certificate.csr -subj "/C=US/O=Amazon/CN=iot.remotethermo.com" \
&& echo -e "[req]\ndistinguished_name = req_distinguished_name\nx509_extensions = v3_ca\nprompt = no\n[req_distinguished_name]\nC = US\nO = Amazon\nCN = Amazon RSA 2048 M02\n[v3_ca]\nbasicConstraints = CA:TRUE\nsubjectKeyIdentifier = hash\nauthorityKeyIdentifier = keyid:always,issuer:always" > ca.conf \
&& openssl req -x509 -new -nodes -key private.key -days 365 -out ca.crt -config ca.conf \
&& openssl x509 -req -in certificate.csr -CA ca.crt -CAkey private.key -CAcreateserial -out certificate.crt -days 365 -extfile ca.conf -extensions v3_ca

Probably it checks the trustchain and it will not work with this method :/