NorthernMan54 / homebridge-tasmota

Plugin for Tasmota devices leveraging Home Assistant auto discovery
Apache License 2.0
35 stars 9 forks source link

'storage' identifier #32

Closed jos149 closed 3 years ago

jos149 commented 3 years ago

Describe Your Problem: As there is no 'issues' section on the homebridge-bme280 page I write it down here: In the config it is possible to use the storage identifier to store data. I am wondering: how do I define this and what are the options? And is it saved in CSV? When I am running this in Docker, where is the file stored? My plan is to load the BME280 data in Grafana, so that's why I asking.

NorthernMan54 commented 3 years ago

The option is used store data for the fakegato module and is not meant for external use. It is a JSON format.

jos149 commented 3 years ago

I see! Thanks for you quick reply!

So, the only option to extract data and plot this into Grafana is to do this over google spreadsheets?

NorthernMan54 commented 3 years ago

Correct

jos149 commented 3 years ago

Then I still have a question: How should I write down my config?

storage: "googleDrive" ?

NorthernMan54 commented 3 years ago

The storage config option is only used by the fakegato package. For the spreadsheet option, you just need to supply a spreadsheet id.

PS I'm not 100% sure if the google spreadsheet is still functional. It was setup a few years ago and google may have changed the API

jos149 commented 3 years ago

Oh I see. Well, at least I could give it a try. Thanks for you response!

NorthernMan54 commented 3 years ago

Personally I use use nodemcu's running Tasmota these days with a wired BME-280 or DHT for data collection sensors. A lot easier to manage and integrate.

jos149 commented 3 years ago

Oh that's also a good idea! Do you use the MQTT functionality for data plotting?

jos149 commented 3 years ago

I see this is also one of yours: https://github.com/NorthernMan54/homebridge-mcuiot/wiki/Instructions-for-Beginners

I used that tutorial for the other temperature sensors in my house. The one directly attached is where my server is.

So with these from the tutorial I guess I can also plot data?

It has this same 'storage' identifier, but that is again also for fakegato and googledrive? Although in the explanation it says storage has as a default 'fs'. That's filesystem right?

NorthernMan54 commented 3 years ago

My node-red dashboard, I'm normalizing all my sensors into homebridge, and am using node-red and 'homebridge-automation' to integrate homebridge data into a dashboard. I use MQTT to integrate my various devices into homebridge.

image

PS I have retired that as part of my rebuild of my home automation technology and normalization of all my nodemcu / esp8266 devices to Tasmota. I found that I had way too much random technology and builds hanging around and simplified everything down to Tasmota.

NorthernMan54 commented 3 years ago

Also, the Indoor chart/graph sensor 'Basement' is a DHT11 wired up to a Raspberry PI

jos149 commented 3 years ago

So, what I actually can do is flashing these Wemos D1 Mini (ESP8266 chip) to Tasmota instead of the software you proposed and send data over MQTT?

NorthernMan54 commented 3 years ago

That is definitely a workable approach, and more scalable than playing with a plugin's data.

As you grow your system one thing to consider is your integration and data strategy. In my setup I normalize all my devices to homebridge, then use the HomeKit Accessory Protocol API on Homebridge as a common API for all other services ( Alexa, Home App and node-red for advanced automation )

Devices --> Plugins ( multiple ) --> Homebridge --> Home App, node-red and Alexa

jos149 commented 3 years ago

I see. I think it is time to do some research haha. Thanks a lot for thinking wiith me ;)! I only started with homebridge a short while ago so a lot of things are new for me, especially the whole MQTT thing.

jos149 commented 3 years ago

I think I will migrate everything. I expect that due to cable length to the sensor the humidity and temperature values are stuck now in the home app for almost a day. So it might not be updating. I am not home so I cannot check the logs. Tasmota would be a great solution for this I think

jos149 commented 3 years ago

Hey, I just migrated my temperature sensors to Tasmota. So the setup is: Wemos D1 mini with Tasmota and BME280 sensor. Somehow, both sensors keep displaying 0 degrees. Do you have any idea why? I cannot image it is because of any cabling or so. So I expect maybe the config?

   {
        "type": "temperatureSensor",
        "name": "Outdoor",
        "mqttOptions": {
            "keepalive": 30
        },
        "topics": {
            "getCurrentTemperature": {
                "topic": "tele/tasmota_7ADCE3/SENSOR",
                "apply": "return JSON.parse(message).BME280.Temperature;"
            }
        },
        "history": "true",
        "accessory": "mqttthing"
    },
    {
        "type": "temperatureSensor",
        "name": "Bedroom",
        "mqttOptions": {
            "keepalive": 30
        },
        "topics": {
            "getCurrentTemperature": {
                "topic": "tele/tasmota_78D7B0/SENSOR",
                "apply": "return JSON.parse(message).BME280.Temperature;"
            }
        },
        "history": "true",
        "accessory": "mqttthing"
    }
NorthernMan54 commented 3 years ago

@jos149 if your using homebridge-tasmota then you have a bigger issue as the config you shared is from homebridge-mqttthing

jos149 commented 3 years ago

I see, what would be the settings for homebridge tasmota? And, is it correct I only need to configure MQTT and the pins to SDL SCA on the wemos?

jos149 commented 3 years ago

Currently doing the following:

    {
        "name": "Tasmota",
        "mqttHost": "192.168.1.141:1883",
        "cleanup": 24,
        "debug": false,
        "history": false,
        "historyInterval": 10,
        "filterAllow": [
            "tele/tasmota_7ADCE3/SENSOR",
            "tele/tasmota_78D7B0/SENSOR"
        ],
        "effects": false,
        "platform": "Tasmota"
    }

which gives me nothing in the home-app

NorthernMan54 commented 3 years ago

Did you follow the tasmota guide to configure a device ? https://tasmota.github.io/docs/BME280/

My notes on setting up various devices are here

https://github.com/NorthernMan54/homebridge-tasmota/blob/master/DEVICES.md

On the tasmota device it self you need to setup mqtt then enable auto discovery with ‘setoption19 1’

for mine I just put this into the tasmota device console

https://github.com/NorthernMan54/homebridge-tasmota/blob/master/DEVICES.md#sample-device-configurations--my-personal-collection-

my mqtt server is called mqtt.local, in your case put your ip.

Also you don’t need the filter option.

jos149 commented 3 years ago

So what you is you go to the console of the tasmota device and then you just type: Backlog MqttHost mqtt.local; topic tasmota_%06X; setoption57 1; setoption19 1

NorthernMan54 commented 3 years ago

Yes, with mqtt host being your mqtt server ip

jos149 commented 3 years ago

yes ok, but i already configured mqtt in the gui, so i guess i do not need to do that anymore.. I now only did 'setoption19 1'

NorthernMan54 commented 3 years ago

And it should now appear

jos149 commented 3 years ago

ok and 57 does???

NorthernMan54 commented 3 years ago

https://tasmota.github.io/docs/Commands/#setoptions

Scan for best access point

jos149 commented 3 years ago

Just to summarize, I did configure the mqtt broker in the tasmota devices with the ip. I did set option 19 to ON. And my config in homebridge is as mentioned above. What do I miss? I do not see anything appear in the apple home app yet.

jos149 commented 3 years ago

The thing that bothers me is the following: I did not tell the wemos anything about what type of hardware is connected. Only the ports are defined (SCL SDA) but, in the console, nothing about the temperature data or anything appears. Is this normal behavior?

jos149 commented 3 years ago

I think I am also missing something in my config.json file, because if I remove the filter options as you mentioned, there is not any ID in the config about the sensor...this seems weird to me.

NorthernMan54 commented 3 years ago

In the device, it should look like this on the console if it is configured correctly. You just wire up the BME, set the GPIO's to the correct SDA/SCL and it just starts working.

image

As I have over 60 Tasmota devices and I didn't want to hand configure each device in the config.json. So the plugin uses the Tasmota auto discovery messages enabled with setoption19.

jos149 commented 3 years ago

Aha! I think I have found the problem. I flashed the wrong image to the WEMOS. It should be tasmota-sensors?

jos149 commented 3 years ago

Because my devices just act like

ôfbylding

jos149 commented 3 years ago

I installed tasmota sensors but somehow I get a similar output. Nothing like BME module. Any idea?

jos149 commented 3 years ago

Ok it works now, one problem: it does not show up as a temperature sensor. But the rest is good.

NorthernMan54 commented 3 years ago

???

jos149 commented 3 years ago

The problem is I can see the sensor data in the web interface of tasmota but I cannot see the data in the home app. It says unsupported device. So it appears but I cannot do anything useful with it. Do you have any idea. I do use full homebridge tasmota now.

NorthernMan54 commented 3 years ago

If the device config in homebridge is wrong you can remove the device with

setoption19 0

then add it again with

setoption19 1

jos149 commented 3 years ago

If the device config in homebridge is wrong you can remove the device with

setoption19 0

then add it again with

setoption19 1

I did do this, and now it shows me that the values in the Home app are of correct temperature but very high humidity. So at least it does not show the 'not supported' message anymore, but I did get an error message: This plugin generated a warning from the characteristic 'Configured Name': Characteristic not in required or optional characteristic section for service . Adding anyway.. And then I got: This plugin generated a warning from the characteristic 'Air Pressure': characteristic was supplied illegal value: number 687 exceeded minimum of 700

So, at least one step further but still not there. Just wondering what air pressure your sensors show. Mine both are around 700 which it very low, mostly it must be around a 1000 hpa. Any idea?

NorthernMan54 commented 3 years ago

I’m wondering if this is being triggered by your topic or something else. If you set debug true it will log the status updates that occur every 5 minutes and we can see the values being passed are.

my preasuure is roughly 990 give or take current conditions. Is the 687 valid for your location or do have a wonky sensor?

the 700 is set here, and I could adjust is lower if it makes sense.

https://github.com/NorthernMan54/homebridge-tasmota/blob/master/src/lib/CustomCharacteristics.ts#L68

jos149 commented 3 years ago

I’m wondering if this is being triggered by your topic or something else. If you set debug true it will log the status updates that occur every 5 minutes and we can see the values being passed are.

Setting debug to true is also done with setoption?

my preasuure is roughly 990 give or take current conditions. Is the 687 valid for your location or do have a wonky sensor?

Well, it would be strange if it is a wonky sensor as both sensors give low values and high humidity. Values I would expect are around 1000 hpa and 50% humidity.

the 700 is set here, and I could adjust is lower if it makes sense.

https://github.com/NorthernMan54/homebridge-tasmota/blob/master/src/lib/CustomCharacteristics.ts#L68

I will have a look.

Also, one thing I noticed today (in the office) the sensor values in the Apple Home app are not updated. I will go home soon and check whether the values changed in the GUI of the sensors.

NorthernMan54 commented 3 years ago

I tweaked the 700 value down to 300 to match the BME280 data sheet. This is published as v0.0.120

The debug option is part of the plugin config, and enables more verbose logging from the plugin in the Homebridge log.

jos149 commented 3 years ago

I tweaked the 700 value down to 300 to match the BME280 data sheet. This is published as v0.0.120

I see. So this means I can change a file (somewhere?) for calibration. Can you explain how I access this?

The debug option is part of the plugin config, and enables more verbose logging from the plugin in the Homebridge log.

I see, so I should have a look at the explanation to find which 'setoption' this is to enable.

NorthernMan54 commented 3 years ago

Just update the homebridge-tasmota plugin to the latest version, I published the tweak

and the debug option is part of the homebridge-tasmota config. Just set it their.

jos149 commented 3 years ago

Still getting this:

Screenshot 2021-07-07 at 19 59 12

Homebridge says everything has been updated. Weird right?

NorthernMan54 commented 3 years ago

I'm thinking that the value is only populated to the accessory config during the initial setup of the accessory, and subsequent restarts don't refresh the value. I'm thinking that if the device was removed and added again it would go away. ( setoption19 0 ; setoption19 1 )

jos149 commented 3 years ago

Hey! I finally managed to arrange everything and now things work fine. Question: Any idea how I can remove the Dewpoint value? I don't want to send it to my home app

NorthernMan54 commented 3 years ago

How is the dew point displayed in the home app? I don’t see it with mine, and I don’t recall coding for it.

jos149 commented 3 years ago

Haha I don't know...but I get this: image

NorthernMan54 commented 3 years ago

I took a minute to look at this further and I’m thinking that the version of tasmota your running is newer than mine ( 8.1.0 j, and it supports the dew point calculation. And tasmota shares the dew point as a temperature, which is supported by the plugin hence your seeing dewpoint.

can you just move it to another room, like a closet or something?

jos149 commented 3 years ago

can you just move it to another room, like a closet or something?

I can, but what's the point?