LordMike / MBW.BlueRiiot2MQTT

Utility to map between Blue Riiots pool API, and Home Assistant MQTT
49 stars 2 forks source link

Discussion #1

Closed foXaCe closed 4 years ago

foXaCe commented 4 years ago

hello very good idea and job.

how to install in home assistant ? it possible to create addon ?

LordMike commented 4 years ago

You run it besides HASS. I prefer running this (and HASS) in docker.

jimloki commented 4 years ago

addons are just docker containers (https://developers.home-assistant.io/docs/hassio_addon_index/)

foXaCe commented 4 years ago

@jimloki I don't have the competence to do this

LordMike commented 4 years ago

Oooh.. neat.. @jimloki ..

I'll have to take a look at what's needed to add them there .. I'm at work right now. But is there a store / repository where these are displayed, like f.ex. HACS has it?

jimloki commented 4 years ago

@LordMike You can do some local testing before publishing on the store. There's a community add-ons store or you can have your own add-on repositorie on github. Everything is explained in the link above.

@foXaCe Too bad. I would have done it if I had the competence also :)

LordMike commented 4 years ago

Yea, I just figured that out.. I've been able to install a local Hass.io install, as my own install is a HA Core setup (apparently).

LordMike commented 4 years ago

@foXaCe @jimloki give it a try

https://github.com/LordMike/hass-addons

jimloki commented 4 years ago

Waouh, that was fast!!! :)

I won't be able to try it because I don't have a Blue Connect device. I was just looking for information for a friend how wants to buy one and wanted to make sure Blue Connect was compatible with Home Assistant.

So it's up to @foXaCe to try it

LordMike commented 4 years ago

@jimloki it is. At least now it is. I was dissatisfied with the lack of support, a lot of the attempts out there will use Emails. As in, having Blue Riiot send an email on every measurement, and then having HASS parse those emails.

That's horrible.

Also, it only provides the values BR provides through emails, which without knowing exactly what it is - most likely won't be everything. From the API, it's possible to pull anything the App shows.

Tell your friend to install the app, and get a feel for it. That's what convinced me. The app works without the blue connect device, and will still let you report values for the pool, and provide recommendations on it. It's actually pretty neat.

jimloki commented 4 years ago

OK, I will. Where do I put the username and password for the mqtt server?

LordMike commented 4 years ago

In the Hass.io setup, it will be:

MQTT:
  Username: a
  Password: b

For regular docker, see the Readme.

foXaCe commented 4 years ago

This add-on is not available on your system.

jimloki commented 4 years ago

@foXaCe To use this add-on, you need to add this address https://github.com/LordMike/hass-addons in the add-ons store in the repositories section, then you can add the add-on in your system.

@LordMike It still doesn't work with the username and password [2020-05-05 11:43:36+00:00 ERR] [MqttNet.MqttClient] Error while connecting with server. [2020-05-05 11:43:36+00:00 WRN] [MBW.BlueRiiot2MQTT.Service.MqttConnectionService] Reconnect failed [2020-05-05 11:44:06+00:00 ERR] [MqttNet.MqttClient] Error while connecting with server. [2020-05-05 11:44:06+00:00 INF] [MqttNet.MqttClient] Disconnected. [2020-05-05 11:44:06+00:00 WRN] [MBW.BlueRiiot2MQTT.Service.MqttConnectionService] Reconnect failed [2020-05-05 11:44:06+00:00 WRN] [MBW.BlueRiiot2MQTT.Service.MqttConnectionService] Server disconnected, attempting reconnect in 00:00:30

and in mosquitto log: 1588679136: New connection from 172.30.32.1 on port 1883. 1588679136: Socket error on client <unknown>, disconnecting.

Are you sure you're using these variables in your code?

foXaCe commented 4 years ago

@jimloki ok but not available for rpi4

SharedScreenshot

LordMike commented 4 years ago

@jimloki I've just found that Hass.io requires me to place all variables into the schema, in order for them to be used..

That's kinda crazy :O

LordMike commented 4 years ago

That configuration system is one of the stupidest I've ever worked with.

Let me know if these changes work out, @jimloki

jimloki commented 4 years ago

Still doesn't work. You should change the version in config.json each time, that way Home assistant will tell me when a new version is out. For now I don't know why I cannot install your latest version. I still got the same default config as the first time, no username and password for the MQTT server

foXaCe commented 4 years ago

[11:58:05 INF] Loading extra config file at /data/options.json [2020-05-06 11:58:06+00:00 ERR] [MqttNet.MqttClient] Error while connecting with server. [2020-05-06 11:58:06+00:00 WRN] [MqttNet.MqttClient] Error while waiting for internal tasks. [2020-05-06 11:58:06+00:00 INF] [MqttNet.MqttClient] Disconnected. [2020-05-06 11:58:06+00:00 WRN] [MBW.BlueRiiot2MQTT.Service.MqttConnectionService] Server disconnected, attempting reconnect in 00:00:30 [2020-05-06 11:58:06+00:00 INF] [Microsoft.Hosting.Lifetime] Application started. Press Ctrl+C to shut down. [2020-05-06 11:58:06+00:00 INF] [Microsoft.Hosting.Lifetime] Hosting environment: Production [2020-05-06 11:58:06+00:00 INF] [Microsoft.Hosting.Lifetime] Content root path: /app [2020-05-06 11:58:09+00:00 ERR] [MBW.BlueRiiot2MQTT.Service.BlueRiiotMqttService] An error occurred while performing the update [2020-05-06 11:58:09+00:00 ERR] [MBW.BlueRiiot2MQTT.Service.BlueRiiotMqttService] An error occurred while pushing updated data to MQTT [2020-05-06 11:58:36+00:00 ERR] [MqttNet.MqttClient] Error while connecting with server. [2020-05-06 11:58:36+00:00 WRN] [MqttNet.MqttClient] Error while waiting for internal tasks. [2020-05-06 11:58:36+00:00 INF] [MqttNet.MqttClient] Disconnected. [2020-05-06 11:58:36+00:00 WRN] [MBW.BlueRiiot2MQTT.Service.MqttConnectionService] Server disconnected, attempting reconnect in 00:00:30 [2020-05-06 11:58:36+00:00 WRN] [MBW.BlueRiiot2MQTT.Service.MqttConnectionService] Reconnect failed

jimloki commented 4 years ago

I finally got it connected with my MQTT server. I can see an entity named binary_sensor.blueriiot2mqtt_status. Unfortunately I cannot do more because I don't have a Blueriiot device. @foXaCe could you please check if you got data coming in?

LordMike commented 4 years ago

@jimloki you can submit manual readings using the app.

LordMike commented 4 years ago

Ooh, right.. the version property.. I've been removing the feed and re-adding it while testing.

foXaCe commented 4 years ago

I finally got it connected with my MQTT server. I can see an entity named binary_sensor.blueriiot2mqtt_status. Unfortunately I cannot do more because I don't have a Blueriiot device.

@jimloki how to ?

jimloki commented 4 years ago

I've put some values in the application last night but still nothing in Home Assistant besides one entity (binary_sensor.blueriiot2mqtt_status)

Capture d’écran du 2020-05-07 09-42-47

Log: [07:36:34 INF] Loading extra config file at /data/options.json [2020-05-07 07:36:36+00:00 INF] [MqttNet.MqttClient] Connected. [2020-05-07 07:36:36+00:00 INF] [Microsoft.Hosting.Lifetime] Application started. Press Ctrl+C to shut down. [2020-05-07 07:36:36+00:00 INF] [Microsoft.Hosting.Lifetime] Hosting environment: Production [2020-05-07 07:36:36+00:00 INF] [Microsoft.Hosting.Lifetime] Content root path: /app [2020-05-07 07:36:36+00:00 ERR] [MBW.BlueRiiot2MQTT.Service.BlueRiiotMqttService] An error occurred while performing the update [2020-05-07 07:36:37+00:00 INF] [MBW.BlueRiiot2MQTT.HASS.HassMqttSensor] Sent new values for BlueRiiot2MQTT Status to MQTT [2020-05-07 07:37:20+00:00 INF] [MqttNet.MqttClient] Disconnected. [2020-05-07 07:37:20+00:00 WRN] [MBW.BlueRiiot2MQTT.Service.MqttConnectionService] Server disconnected, attempting reconnect in 00:00:30 [2020-05-07 07:37:50+00:00 INF] [MqttNet.MqttClient] Connected.

jimloki commented 4 years ago

It's working now, I thing... I put some values in the app as you said and now I can see more messages on the mqtt server and more entities in home assistant. Maybe I had a problem with my password in the addon, but I didn't have a warning about it.

I'm French by the way. Is it possible to get the messages in my language. I see that you have the option for the docker cli but not for the addon

foXaCe commented 4 years ago

@jimloki I am French too. I would like to exchange with you so that you explain to me because me it does not work.

jimloki commented 4 years ago

Sorry @LordMike but I'll switch to French for this short message @foXaCe Où veux-tu discuter? Je suis sur Discord (loki#2224)

foXaCe commented 4 years ago

ok works now

image

foXaCe commented 4 years ago

please add this option

Language: fr UpdateInterval: '00:00:00'

barto64 commented 4 years ago

It looks pretty nice. I am planning to buy this Blue Connect device, but I have a doubt ....

Do I need to buy the premium subscription for this component to work ?

I mean that because looking to the product web it looks like the basic version is only able to connect to the device using Bluethooth (Blue Connect Go), and for you to be able to access it through the internet you need to buy a more expensive one (Blue Connect)

jimloki commented 4 years ago

@barto64 I think you're right, unfortunately

barto64 commented 4 years ago

@barto64 I think you're right, unfortunately

Thanks a lot for your prompt answer. I have already ordered the device. One of the toys I use is ESP32 cards which use BLE to talk lot of bluetooth devices, I will take a look first to see what I can get from there. Worst case scenario will be to buy the premium subscription and use your add-on.

jimloki commented 4 years ago

It's not my addon. I don't even have a blueriiot device. Like I said earlier, I was looking for information for a friend who wanted to buy one and wanted to make sure it could work with home assistant (I'm the one taking care of his installation). Now I'm not sure he will buy one because of this, plus he's starting to ask questions about blueriiot devices' reliability...

Hopefully someone will find a way to access the data by bluetooth, that would be the best option. May be 1technophile could help (see https://community.home-assistant.io/t/blue-connect-pool-measurements/118901/23 and https://github.com/1technophile/OpenMQTTGateway)

LordMike commented 4 years ago

@barto64 you do not need the premium subscription. The API and app works without it. The premium subscription, afaik, only provides you with the Sigfox communication for the Blue Connect, so that it can make the ~20 readings a day.

Without the subscription, you're limited to doing manual bluetooth readings using your phone. It may be that the extender thingy doesn't need the subscription?..

That said. I much prefer the automatic-ness of it. :)

I've seen some threads related to making a bluetooth reader/implementation to make automated readings using a bluetooth dongle. Dunno how far that got though.

LordMike commented 4 years ago

I can add the language option to the Hass.io schema.

LordMike commented 4 years ago

@foXaCe it should be possible to specify the language now. I've also set the version of the Hass.io addon doc, to 0.1.0.

jimloki commented 4 years ago

Without the subscription, you're limited to doing manual bluetooth readings using your phone. It may be that the extender thingy doesn't need the subscription?..

I think you're right about the extender. I read the manual and it doesn't mention a subscription. It's just a wifi bridge for the blue connect

foXaCe commented 4 years ago

@LordMike thanks for language option

but

ERROR (SyncWorker_16) [supervisor.docker.interface] Can't install lordmike/blueriiot2mqtt-aarch64:0.1.0 -> 404 Client Error: Not Found ("manifest for lordmike/blueriiot2mqtt-aarch64:0.1.0 not found: manifest unknown: manifest unknown").

jimloki commented 4 years ago

Oups, maybe it's because of me. I told @LordMike to change the version in the config.json so that Home Assistant could warn us when an update is available. Now it's referencing a container that doesn't exist on the docket hub...

foXaCe commented 4 years ago

@jimloki do you have the same problem?

jimloki commented 4 years ago

yes

foXaCe commented 4 years ago

how to fix ?

LordMike commented 4 years ago

Oooh.. the version is the docker label... Right. God f...

It'll have to be latest for now. I'll have to do something with docker hubs builds to get versioned stuff.

LordMike commented 4 years ago

Without the subscription, you're limited to doing manual bluetooth readings using your phone. It may be that the extender thingy doesn't need the subscription?..

I think you're right about the extender. I read the manual and it doesn't mention a subscription. It's just a wifi bridge for the blue connect

Note that I don't know if there's any automation in this .. I could easily imagine that Blue Riiot would sell the extender, but not poll the Blue device automatically, unless you had the subscription.

I will say though, that I'm fairly confident the API I reversed, is able to request a measurement. So it would entirely be possible to code the automation within HASS.. (push to a specific topic every N minutes).

barto64 commented 4 years ago

I am a bit confuse. Just for me to understand it.

How the BlueRiiot2MQTT talk to the Blue Connect Device?

Does it use Bluetooth? Is it via WAN or LAN?

For what I read the Blue Connect use SigFox to be permanently connected to Internet and only need the WiFi extender in case of lack of SigFox coverage. A different thing is that w/o the subscription you do not get some benefits that the Premium subscription provides, like the 20 daily read, statistics, historical info,etc.

jimloki commented 4 years ago

BlueRiiot2MQTT talks to the cloud. The Blue connect device talks also to the cloud through sigfox or the wifi extender. You can also take measurements with your smartphone connected via Bluetooth to the Blue connect device. These measurements will then be sent to cloud.

That's what I understand

LordMike commented 4 years ago

@barto64 -- jimloki is correct. I use the API that Blue Riiot provides for their app. I have not figured out how to talk to the blue device directly. I'm leaving that for others.

barto64 commented 4 years ago

@LordMike , I am not especially interested on a Bluetooth based connection, my concern was that in absence of the Premium Subscription I could not integrate the device with my HA using your add-on. In any case I will find this out soon, I should get my device today.

Is the add-on already back to work ? I saw some problems in the chat ....

LordMike commented 4 years ago

Well, it's been working for a while. There was a mishap with the version identifier in HASS, but that's been partly resolved. Turns out I need to tag my releases... :/

jimloki commented 4 years ago

The language option has no effect. The messages are still in english with "fr" in the config

foXaCe commented 4 years ago

i confirm, all languages rest en english