Giter VIP home page Giter VIP logo

Comments (47)

bereska avatar bereska commented on August 21, 2024

i think I am slowly getting it but not quite. Since the platform is 'tasmota' for sensors in configuration.yaml, no need for mqtt configuration for each sensor, right?

from hass.

hhaim avatar hhaim commented on August 21, 2024

It is a good idea to have one docker for all the services.
Tasmota talk to broker with Mqtt protocol. Component just need the topic.
Hass is another client to the broker.

from hass.

bereska avatar bereska commented on August 21, 2024

thanks for your advice
the sensors show up in GUI as 'unavailable'
if Tasmota is an mqtt client, it needs a login name and password
i know how to create a new client user name and password in mosquitto
but i don't know how to pass it to Tasmota

from hass.

bereska avatar bereska commented on August 21, 2024

ha logs:

2019-07-25 23:54:33 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for tasmota which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you do experience issues with Home Assistant.,
2019-07-25 23:54:34 WARNING (MainThread) [homeassistant.components.mqtt] Signature of MQTT msg_callback 'custom_components.tasmota.sensor.state_received' is deprecated,
2019-07-25 23:54:34 WARNING (MainThread) [homeassistant.components.mqtt] Signature of MQTT msg_callback 'custom_components.tasmota.sensor.tele_received' is deprecated

from hass.

hhaim avatar hhaim commented on August 21, 2024

You need to configure hass Mqtt see here:

mqtt:

from hass.

bereska avatar bereska commented on August 21, 2024

thank you
I already have it configured for mosquitto like this in configuration.yaml:

mqtt:
discovery: true
discovery_prefix: 'homeassistant'
broker: localhost
port: 1883
client_id: home-assistant-1
username: ha
password: 'superstrongpassword'
birth_message:
topic: "homeassistant/status"
payload: 'online'
qos: 1
retain: True
will_message:
topic: "homeassistant/status"
payload: 'offline'
qos: 1
retain: True

my homeassistant in docker (ha) and all the other mqtt clients successfully connected to mosquitto
am i missing something here?
thank you for your help

from hass.

hhaim avatar hhaim commented on August 21, 2024

Looks ok. You don’t need to do anything else. Verify that it is connected to the broker.

from hass.

bereska avatar bereska commented on August 21, 2024

I think so, too
the homeassistant (ha) is connected per mosquitto logs:
'1564088068: New client connected from 172.18.0.1 as home-assistant-1 (c1, k60, u'ha')

172.18.0.1 is homeassistant docker network address
172.18.0.6 is mosquitto docker network address

i can access the wemo in browser at http://192.168.2.154/
the homeassistant runs on rpi3 at http://192.168.2.230/

the meter is not connected to the water line, but the wemo takes readings from it if I just blow some air through:

Counter1 23

yet, the sensors show up in GUI as 'unavailable'
any ideas?
thank you

from hass.

hhaim avatar hhaim commented on August 21, 2024

I would log into hass docker and run
mosquitto_sub -t topic (and server/user/password)

To verify that topic are redirect.

I don’t think you have a component issue.

from hass.

bereska avatar bereska commented on August 21, 2024

pi@bereskapi-ha:~ $ mosquitto_sub -v -t homeassistant/status -u ha -P ########
homeassistant/status online
^C
pi@bereskapi-ha:~ $ mosquitto_sub -v -t tele/hass1/LWT -u ha -P #########
^C
pi@bereskapi-ha:~ $

from hass.

bereska avatar bereska commented on August 21, 2024

also I could not find where I need to put these values:
Tasmota configuration (once)
CounterDebounce 1000
TelePeriod 60
SetOption36 20

from hass.

bereska avatar bereska commented on August 21, 2024

I figured I need to run the above commands in Console, but I can't pair your custom component with homeassistant, the sensors are still show up as 'unavailable'
pls help

from hass.

bereska avatar bereska commented on August 21, 2024

ant these warnings are ha logs:

2019-07-25 23:54:33 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for tasmota which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you do experience issues with Home Assistant.,
2019-07-25 23:54:34 WARNING (MainThread) [homeassistant.components.mqtt] Signature of MQTT msg_callback 'custom_components.tasmota.sensor.state_received' is deprecated,
2019-07-25 23:54:34 WARNING (MainThread) [homeassistant.components.mqtt] Signature of MQTT msg_callback 'custom_components.tasmota.sensor.tele_received' is deprecated

from hass.

hhaim avatar hhaim commented on August 21, 2024

Hi,
The warning are expected, this is not the issue. I think you have a networking issue betwean the dockers.

I suggest to do this to verify were it:

  1. Let's say your topic is water_out

In the GUI in the water sensor Console you will see something like this:

19:07:36 MQT: tele/water_out/STATE = {"Time":"2019-07-27T19:07:36","Uptime":"1T12:15:39","Vcc":2.710,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"POWER":"OFF","Wifi":{"AP":1,"SSId":"","BSSId":"","Channel":4,"RSSI":46,"LinkCount":2,"Downtime":"0T00:00:16"}}
19:07:36 MQT: tele/water_out/SENSOR = {"Time":"2019-07-27T19:07:36","COUNTER":{"C1":155834}}

Now login into the hass docker and run this and wait 60 sec

mosquitto_sub -u [user] -P [pass] -t +/water_out/#

Replace user/password with the right values. You should see the same like in the Console

{"Time":"2019-07-27T19:06:36","Uptime":"1T12:14:39","Vcc":2.710,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"POWER":"OFF","Wifi":{"AP":1,"SSId":"","BSSId":"","Channel":4,"RSSI":48,"LinkCount":2,"Downtime":"0T00:00:16"}}
{"Time":"2019-07-27T19:06:36","COUNTER":{"C1":155834}}

If you don't see it, try the same from the broker docker

If you don't see the messages you will need to debug docker configuration.

In my case hass and broker and iot are on the same network in case of mqtt with docker there is a NAT involved so you need to know what you are doing

from hass.

hhaim avatar hhaim commented on August 21, 2024

Can we close this?

from hass.

bereska avatar bereska commented on August 21, 2024

hi @hhaim, not quite. I have tried your solution, it didn't work for me, sensors still 'unavailable' in GUI. Then I just configured Wemos for mqtt. I showed up in GUI. It works great except for the known problem of resetting counter after power loss/reboot. I know your library deals with it somehow. Is there there a way to implement your solution just for this one water meter pulse sensor? Maybe like running Rules in console? Thank you

from hass.

bereska avatar bereska commented on August 21, 2024

or python script maybe?

from hass.

hhaim avatar hhaim commented on August 21, 2024

Let me see if I understand,
A simple mqtt sensor works (except the reset issue) and my custom component does not (unavailablel)?

from hass.

bereska avatar bereska commented on August 21, 2024

yes, correct. And like you said, it's probably because of my docker network setup which I don't want to change since I have 9 docker containers and 30+ sensors running just fine. It is just this bloody water meter pulse sensor that I'm struggling with)

from hass.

bereska avatar bereska commented on August 21, 2024

00:00:00 CFG: Loaded from flash at F6, Count 182
00:00:00 Project sonoff Sonoff Version 6.6.0(release-sonoff)-2_3_0
00:00:00 WIF: Connecting to AP2 TP-LINK_72DC in mode 11N as esp8266_water-1825...
00:00:04 WIF: Connected
00:00:04 HTP: Web server active on esp8266_water-1825 with IP address 192.168.2.71
00:00:05 MQT: Attempting connection...
00:00:05 MQT: Connected
00:00:05 MQT: tele/esp8266_water/LWT = Online (retained)
00:00:05 MQT: cmnd/esp8266_water/POWER =
00:00:05 MQT: tele/esp8266_water/INFO1 = {"Module":"Sonoff Basic","Version":"6.6.0(release-sonoff)","FallbackTopic":"cmnd/DVES_42C721_fb/","GroupTopic":"sonoffs"}
00:00:06 MQT: tele/esp8266_water/INFO2 = {"WebServerMode":"Admin","Hostname":"esp8266_water-1825","IPAddress":"192.168.2.71"}
00:00:06 MQT: tele/esp8266_water/INFO3 = {"RestartReason":"Power on"}
00:00:06 MQT: stat/esp8266_water/RESULT = {"POWER":"ON"}
00:00:06 MQT: stat/esp8266_water/POWER = ON
13:58:03 MQT: tele/esp8266_water/STATE = {"Time":"2019-07-31T13:58:03","Uptime":"0T00:00:14","Heap":16,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"POWER":"ON","Wifi":{"AP":2,"SSId":"TP-LINK_72DC","BSSId":"B0:4E:26:D5:72:DC","Channel":13,"RSSI":84,"LinkCount":1,"Downtime":"0T00:00:04"}}
13:58:03 MQT: tele/esp8266_water/SENSOR = {"Time":"2019-07-31T13:58:03","COUNTER":{"C1":4}}

from hass.

hhaim avatar hhaim commented on August 21, 2024

@bereska I've just tested it with latest hass and this

sensor:

  - platform: uptime

  - platform: tasmota
    name: water_total
    stopic: water_out
    id: 1
    unit_of_measurement: 'l'
    icon: mdi:water-pump
    expire_after: 300
    value_template: "{{ (45497 + (value))|int }}"

and it works fine

image

image

so it is something else

please send

  1. mqtt configuration that works
  2. custom comp that does not work

from hass.

bereska avatar bereska commented on August 21, 2024

Снимок экрана 2019-07-31 в 23 30 51

as for the custom comp it is your custom_components folder placed into my config directory

from hass.

bereska avatar bereska commented on August 21, 2024

I just tried one more time from scratch per your guide
It looks like the sensor cannot connect to your custom component

00:00:00 CFG: Loaded from flash at F9, Count 11
00:00:00 Project sonoff Sonoff Version 6.6.0(release-sonoff)-2_3_0
00:00:00 WIF: Connecting to AP1 bereska24 in mode 11N as sonoff-1825...
00:00:04 WIF: Connected
00:00:04 HTP: Web server active on sonoff-1825 with IP address 192.168.2.71
22:10:46 RSL: tele/sonoff/STATE = {"Time":"2019-07-31T22:10:46","Uptime":"0T00:00:59","Heap":14,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"POWER":"ON","Wifi":{"AP":1,"SSId":"bereska24","BSSId":"2C:FD:A1:3E:16:50","Channel":4,"RSSI":20,"LinkCount":1,"Downtime":"0T00:00:04"}}
22:10:46 RSL: tele/sonoff/SENSOR = {"Time":"2019-07-31T22:10:46","COUNTER":{"C1":20}}

from hass.

bereska avatar bereska commented on August 21, 2024

even if I change topic to water_out in mqtt config of the sensor, it is still 'unavailable' in GUI

2:35:59 RSL: tele/water_out/STATE = {"Time":"2019-07-31T22:35:59","Uptime":"0T00:11:59","Heap":13,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"POWER":"ON","Wifi":{"AP":1,"SSId":"bereska24","BSSId":"2C:FD:A1:3E:16:50","Channel":4,"RSSI":26,"LinkCount":1,"Downtime":"0T00:00:04"}}
22:35:59 RSL: tele/water_out/SENSOR = {"Time":"2019-07-31T22:35:59","COUNTER":{"C1":20}}

from hass.

hhaim avatar hhaim commented on August 21, 2024

You are sending the web console output. This does not prove the Mqtt is working.
Please run the mosqutto_sub procedure above or/and send the hass Mqtt sensor yaml that you claim that works.

You are sending irrelevant information and not answering the questions.
It becoming difficult to help you

from hass.

hhaim avatar hhaim commented on August 21, 2024

Tasmota User/password for the Mqtt does not seem right!

from hass.

bereska avatar bereska commented on August 21, 2024

this sensor works:

  • platform: mqtt
    name: "Water Meter Home"
    state_topic: "tele/esp8266_water/SENSOR"
    value_template: "{{ value_json['COUNTER'].C1|int *5 }}"
    unit_of_measurement: "Liters"
    qos: 1

from hass.

bereska avatar bereska commented on August 21, 2024

"Tasmota User/password for the Mqtt does not seem right!" - I don't get it. Do i need to create an mqtt user/password for tasmota?

from hass.

bereska avatar bereska commented on August 21, 2024

all my sensors are inside ha configuration.yaml, not a separate sensors.yaml. Does it matter for your custom_component?

from hass.

hhaim avatar hhaim commented on August 21, 2024

"
Please send YAML

  1. mqtt configuration that works
  2. custom comp that does not work
    "

from hass.

bereska avatar bereska commented on August 21, 2024

sorry, I don't get it, I already sent it ti you before, here it is again:

mqtt:
discovery: true
discovery_prefix: 'homeassistant'
broker: localhost
port: 1883
client_id: home-assistant-1
username: ha
password: superstrongpassword
birth_message:
topic: "homeassistant/status"
payload: 'online'
qos: 1
retain: True
will_message:
topic: "homeassistant/status"
payload: 'offline'
qos: 1
retain: True

from hass.

hhaim avatar hhaim commented on August 21, 2024

This is the mqtt client configuration, I need to see the sensor that is unavailable (uses the custom component)

It should be something like this:

sensor:

  - platform: tasmota
    name: water_total
    stopic: water_out
    id: 1
    unit_of_measurement: 'l'
    icon: mdi:water-pump
    expire_after: 300
    value_template: "{{ (45497 + (value))|int }}"

from hass.

bereska avatar bereska commented on August 21, 2024

that is exactly it! I followed your guide!

  • platform: tasmota
    name: water_total
    stopic: water_out
    id: 1
    unit_of_measurement: 'l'
    icon: mdi:water-pump
    expire_after: 300
    value_template: "{{ (45497 + (value))|int }}"

from hass.

hhaim avatar hhaim commented on August 21, 2024

@bereska very hard to get a clear answer to a very simple question.

I assume your answer is this:

  1. This sensor works
sensor:

   platform: mqtt
   name: "Water Meter Home"
   state_topic: "tele/esp8266_water/SENSOR"
   value_template: "{{ value_json['COUNTER'].C1|int *5 }}"
   unit_of_measurement: "Liters"
   qos: 1
  1. This custom sensor does not work
sensor 
   platform: tasmota
   name: water_total
   stopic: water_out
   id: 1
   unit_of_measurement: 'l'
   icon: mdi:water-pump
   expire_after: 300
   value_template: "{{ (45497 + (value))|int }}"

Am I correct?

from hass.

bereska avatar bereska commented on August 21, 2024

yes

from hass.

hhaim avatar hhaim commented on August 21, 2024

How could it work?
it should be

sensor 
   platform: tasmota
   name: water_total
   stopic: esp8266_water
   id: 1
   unit_of_measurement: 'l'
   icon: mdi:water-pump
   expire_after: 300
   value_template: "{{ (45497 + (value))|int }}"

from hass.

bereska avatar bereska commented on August 21, 2024

thank you, let me correct this and report back
also I assume that 'value_template: "{{ (45497 + (value))|int }}"' is specific to your water meter with initial reading of 45497, right? so I can adjust it according to mine? I figured my sensor gives a pulse every 5 liters even though the meter passport says 1 pulse per 10 liters (go figure!) so in my case that line would be 'value_template: "{{ (630 + (value))|int *5}}", correct?
thanks for bearing with stupid me

from hass.

bereska avatar bereska commented on August 21, 2024

ok, the sensor finally shows up in GUI but it does not get updated even thought the sensor keeps on sending new values as the water flows(
here is my config from yaml:

  • platform: tasmota
    name: "Water Home"
    stopic: esp8266_water
    id: 1
    unit_of_measurement: 'Liters'
    icon: mdi:water-pump
    expire_after: 300
    value_template: "{{ (720 + (value))|int *5 }}"

thanks for your patience

from hass.

hhaim avatar hhaim commented on August 21, 2024

Have a look here:
https://www.home-assistant.io/docs/configuration/templating/

from hass.

bereska avatar bereska commented on August 21, 2024

I tried the following but it gives me an error
homeassistant.exceptions.TemplateError: UndefinedError: 'value_json' is undefined

  • platform: tasmota
    name: "Water Home"
    stopic: esp8266_water
    id: 1
    unit_of_measurement: 'Liters'
    icon: mdi:water-pump
    expire_after: 300

from hass.

bereska avatar bereska commented on August 21, 2024

sorry, this is full

  • platform: tasmota
    name: "Water Home"
    stopic: esp8266_water
    id: 1
    unit_of_measurement: 'Liters'
    icon: mdi:water-pump
    expire_after: 300
    value_template: "{{ value_json['COUNTER'].C1 | int *5 }}"

from hass.

bereska avatar bereska commented on August 21, 2024

this same very 'value_template: "{{ value_json['COUNTER'].C1 | int *5 }}"' works just fine with an mqtt sensor

from hass.

bereska avatar bereska commented on August 21, 2024

I don't think the template is wrong, the sensor just fails to get the values to homeassistant

2019-08-02 00:54:56 DEBUG (MainThread) [homeassistant.components.mqtt] Subscribing to tele/esp8266_water/LWT,
2019-08-02 00:54:56 DEBUG (MainThread) [homeassistant.components.mqtt] Subscribing to tele/esp8266_water/STATE,
2019-08-02 00:54:56 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on tele/esp8266_water/LWT (retained): b'Online',
2019-08-02 00:54:56 DEBUG (MainThread) [homeassistant.components.mqtt] Subscribing to tele/esp8266_water/SENSOR

pi@bereskapi-ha:~ $ mosquitto_sub -v -t +/esp8266_water/# -u ha -P password
tele/esp8266_water/LWT Online

from hass.

hhaim avatar hhaim commented on August 21, 2024

@bereska better to close this and move the thread to hass forum.
Your questions are not related to the component

from hass.

bereska avatar bereska commented on August 21, 2024

How come 'not related'? I have two identical pulse sensors: one configured with mqtt, the other with your component. The first one works (except for power/reboot issue), the second doesn't

from hass.

hhaim avatar hhaim commented on August 21, 2024

There are 27 messages in this thread and still there is no Mqtt information, no definition of “does not work”. The only issue I saw relates to not reading the instructions and the other relates to templates that is general engine that you can google /ask in other places. If you have specific component question please provide the full information in one message.
Mqtt/template/networking questions are not for here.

from hass.

hhaim avatar hhaim commented on August 21, 2024

Too old

from hass.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.