StyraHem / ShellyForHASS

Shelly smart home platform for Home Assistant
MIT License
619 stars 112 forks source link

No errors in log, but not working for me #52

Closed woody4165 closed 4 years ago

woody4165 commented 5 years ago

Hi

I've installed via HACS and I'm on version 0.0.15 My config is

shelly:
  discovery: true
  version: true
  show_id_in_name: true
  additional_information: true
  power_decimals: 2
  sensors: 
    - power
    - rssi
    - uptime
    - over_power
    - device_temp
    - over_temp
    - cloud
    - mqtt
    - battery

I don’t see them in MQTT integrations and I don't see any of the sensors requested (rssi, mqtt, cloud and so on). I’ve also tried to use the - all option instead of defining one by one.

I’ve also defined in the log

logger:
  default: error
  logs:
    custom_components.shelly: debug

but I don’t see any error.

In the log I see

2019-08-20 11:57:35 INFO (SyncWorker_5) [custom_components.shelly] Starting shelly, 0.0.15 2019-08-20 11:57:35 INFO (SyncWorker_5) [custom_components.shelly] pyShelly, 0.0.31

What can I check?

Thanks

hakana commented 5 years ago

Thanks,

You can see the switches? When you click on a switch can you see the attributes like rssi for that device?

You can try to add pyShelly for debug logging:

logger:
  default: error
  logs:
      pyShelly: debug
woody4165 commented 5 years ago

Thank @hakana

I remember I've installed and removed a few time later when first was created.

I don't think I can see the switches that ShellyforHass should create.

This is what I see in the MQTT Integrations panel

Schermata 2019-08-20 alle 14 22 59

But the fw I see here is not the real fw of my Shelly 1 that is 1.5.0-hotfix4

Consider that I have already created manually covers and switches using the mqtt like this example

cover: 
  - platform: mqtt
    name: "Tenda sala"
    command_topic: "shellies/shellyswitch-xxxxxx/roller/0/command"
    position_topic: "shellies/shellyswitch-xxxxxx/roller/0/pos"
    set_position_topic: "shellies/shellyswitch-xxxxxx/roller/0/command/pos"
    availability_topic: 'shellies/shellyswitch-xxxxxx/online'
    unique_id: 'Shelly Tenda sala'
    qos: 0
    retain: false
    payload_open: "close"
    payload_close: "open"
    payload_stop: "stop"
    payload_available: 'true'
    payload_not_available: 'false'
    position_open: 0
    position_closed: 100
    optimistic: false

switch: 
  - platform: mqtt
    name: "Shelly1_1"
    state_topic: "shellies/shelly1-yyyyyy/relay/0"
    command_topic: "shellies/shelly1-yyyyyy/relay/0/command"
    payload_on: "on"
    payload_off: "off"
    state_on: "on"
    state_off: "off"
    optimistic: false
    qos: 0
    retain: false

After adding in the logger what you've suggested I see

2019-08-20 14:16:38 INFO (SyncWorker_8) [custom_components.shelly] Starting shelly, 0.0.15
2019-08-20 14:16:38 INFO (SyncWorker_8) [pyShelly] Init pyShelly 0.0.31
2019-08-20 14:16:38 INFO (SyncWorker_8) [custom_components.shelly] pyShelly, 0.0.31
hakana commented 5 years ago

ShellyForHASS have nothing to do with MQTT. ShellyForHASS use CoAP for discovering devices, that is multicasts over UDP port 5683. If you run this python script in your teminal you can see if it receive the CoAP messages.

https://github.com/StyraHem/ShellyForHASS/blob/master/util/test.py

woody4165 commented 5 years ago

Should I change anything (IP Address) in the test.py ?

If I don't change I get no response and it stuck.

If I put a local IP address of one of my shelly 1 I get this error

Traceback (most recent call last):
  File "test.py", line 11, in <module>
    sock.setsockopt(socket.IPPROTO_IP, socket.IP_ADD_MEMBERSHIP, mreq)
OSError: [Errno 22] Invalid argument

In the Shelly configuration COAP is not selected, otherwise I cannot select MQTT

Schermata 2019-08-20 alle 14 50 57

hakana commented 5 years ago

No you should not change any thing in script. That it not return any CoAP messages mean something in between the Shelly and HA stop them. It could be the router or the fire wall in your HA machine. Sometime it helps to turn in IGMP in your router if there is a setting for that. Some times you need to enable Multicasts in HA machine. I can't help you more than that.

hakana commented 5 years ago

The plugin does not require you turn on "Enable action execution via CoAP protocol)

woody4165 commented 5 years ago

Ok, thanks for your explanation

I have Hassio installed on an Intel NUC with Proxmox as Virtualizer, Ubuntu Server in the VM and Hassio installed in Docker. Maybe something related to this is the cause, but everything else I have installed in Hassio, plugins and other is working fine. I have Nodered, MotionEye and other stuff as plugin.

Really don't know where to look at, but I am really sad I couldn't use this component!

I'm using Portainer as Docker manager.

Maybe someone who is more expert than me can help on how to solve this...

hakana commented 5 years ago

Can you connect a standard computer with Pyton to the network, and run the test.py? If that work you know the router are ok. You can try both connect to WiFi and LAN and see if any difference.

I search on google on multicast and Proxmox maybe you can find any thing there. https://www.google.com/search?q=Proxmox+ubunto+multicast

woody4165 commented 5 years ago

just tested test.py on an LinuxMint installation on a laptop, with no virtualization.

Same stuff, no messages.

My modem/router is a Fritz 7590 and I am connected directly to it via cable.

So there is something elsewhere.... Really odd!

AFAIK Fritz 7590 supports multicast

Schermata 2019-08-20 alle 15 51 20

hakana commented 5 years ago

Have you looked on the settings in the router? Because you not receive the messages in laptop the problem must be in the router. Look for igmp settings abd try to do some changes.

woody4165 commented 5 years ago

There are no IGMP particular settings in my router. Should I open any particular port ?

Is it possible to use another port instead of the 5683 ?

It seems that this port is already in use (but I can't imagine which application is using it, maybe is the ShellyforHass plugin)

netstat -ln | grep 5683 gives

udp 0 0 0.0.0.0:5683 0.0.0.0:*

while on 5682, for example, return nothing

Now I've asked in a local Fritz forum to have some more information regarding Multicast / IGMP.

Hope to have some news

woody4165 commented 5 years ago

Some news.

I downloaded a Windows tool called Multicast Tester which has a transmitter and a Receiver part.

If I set the Trasmitter to 224.0.1.187 port 5683 and launch the test.py I get the messages sent

So Multicast should work, isn't it?

It seems that the problem is the "transmitter" part that is not transmitting, maybe.

hakana commented 5 years ago

Are you testing this between different computers? Also test to connect the transmitter by WiFi.

woody4165 commented 5 years ago

The transmitter is on a laptop via cable and the test.py is directly on the Hassio server via cable.

I have tried also on the laptop connected via Wifi and Hassio via cable and it's working

hakana commented 5 years ago

That is very strange... Can you post a message on the Shelly support and see if they can help you. You can also test to upgrade to latest fw 1.5.1 and see if that helps.

https://www.facebook.com/groups/ShellyIoTCommunitySupport/

woody4165 commented 5 years ago

Ok, I'll try

Just to understand it better, all the Shellies send COAP messages to 224.0.1.187 port 5683 , is it correct?

hakana commented 5 years ago

Yes!

woody4165 commented 5 years ago

Sorry, I haven't removed the last sentence from the previous message

woody4165 commented 5 years ago

I have left the test.py active and now I see two identical messages

b'P\x01\x00\n\xb3cit\x01d\xff'
b'P\x01\x00\n\xb3cit\x01d\xff'

Don't know what they mean and where do they come from...

hakana commented 5 years ago

That is sent from the Shelly plugin in HASS

woody4165 commented 5 years ago

Today I downloaded a Windows tool for Shelly, ShellyAdmin, that uses COAP to communicate with Shellies and report all the Shellies in the lan.

Schermata 2019-08-21 alle 11 11 45

And this is what I get fro test.py

b'P\x01\x82*\xb3cit\x01d'
b'P\x01\xc6k<192.168.1.84\x83cit\x01d'
hakana commented 5 years ago

Are you running Shelly.Admin and test.py on the same computer?

woody4165 commented 5 years ago

Nope. Shelly admin on the Windows laptop and test.py on the Hassio server with Proxmox But this morning I tried also with an Hassio fresh install on a Rpi3 with docker. Same result.

hakana commented 5 years ago

Do you have the possibility to run the test.py on the window laptop?

woody4165 commented 5 years ago

I don't have python installed. I will try tomorrow afternoon.

woody4165 commented 5 years ago

Just tested on same laptop, ShellyAdmin and test.py

same result as if they are on separate computer

b'P\x01\x7f\xaf\xb3cit\x01d'
b'P\x01\xc3\xf1<192.168.xxx.xxx\x83cit\x01d'
errecla commented 5 years ago

Hi all, I have some problem of Woody4165. This is my config: Vodafone station revolution with firmware 5.4.8.1.327.1.51 HassOS version 2.12 on Raspberry Pi different shelly devices with firmware v1.5.2 or 1.5.3 shelly: in my configuration.yaml file on hassio I have Mosquitto Broker and all devices are connected to Hassio with MQTT protocol. My problem is: with version 0.0.15 I see shelly devices but all are offline or "non disponibile" with version 0.0.18 I don't see any shelly devices. any idea?

hakana commented 5 years ago

Is it possible for me to login by ssh on any of your systems or remote access with some other system? I can't reproduce this my self.

woody4165 commented 5 years ago

can I contact you via PM?

hakana commented 5 years ago

@woody4165 Yes

woody4165 commented 5 years ago

yes

hakana commented 5 years ago

You can email me hakan(at)tarra.se

mclaudiopt commented 5 years ago

hi there. i also have the same problem...

mclaudiopt commented 5 years ago

how can i run the py file?

mclaudiopt commented 5 years ago

image

but with the tool shelly.admin it detects all my devices

image

Boogs77 commented 5 years ago

Hi Guys. I have same problem.

hakana commented 5 years ago

Any one that can help giving me access to there system? I can't reproduce this and I have tried a lot. I installed HassIO, Raspian etc but it working for me ;(

mclaudiopt commented 5 years ago

yes i can give acess. teamviewer?

hakana commented 5 years ago

@mclaudiopt Yes that will help! What chat are you using?

brama1966 commented 5 years ago

Well i had the same issue. didn't think it was working. no errors But now i get it! its because i had an expectation that HA would announce it discovered new devices just like it does with MQTT or ESPHOME. nope not true its not till i looked in unused entities that i saw my shelly 2 switch was there hiding away with all the sensors. still undecided if i will keep the Shelly FW or ESPhome it like a have done with all my other shellies

woody4165 commented 5 years ago

I think you can see the same unused entities in Developer Tools->States if you know the name or part of the name, but clicking the Unused Entities menu you can see all together.

I don't see them anyway in the Unused Entities menu...

mclaudiopt commented 5 years ago

@hakana discord or teamviewer or skype...any one :-) today after 6pm its ok for you? PM to exchange acess

mclaudiopt commented 5 years ago

@hakana meanwhile this is the log

2019-08-26 13:14:23 DEBUG (Thread-2) [pyShelly] IGMP fix
2019-08-26 13:15:23 DEBUG (Thread-2) [pyShelly] IGMP fix
2019-08-26 13:16:23 DEBUG (Thread-2) [pyShelly] IGMP fix
2019-08-26 13:17:23 DEBUG (Thread-2) [pyShelly] IGMP fix
2019-08-26 13:18:23 DEBUG (Thread-2) [pyShelly] IGMP fix
2019-08-26 13:19:23 DEBUG (Thread-2) [pyShelly] IGMP fix
2019-08-26 13:20:23 DEBUG (Thread-2) [pyShelly] IGMP fix
2019-08-26 13:21:23 DEBUG (Thread-2) [pyShelly] IGMP fix
Boogs77 commented 5 years ago

@hakana if you need I will be available to TeamViewer connection. Let me know if you need it

errecla commented 5 years ago

Hi all, I reinstall HASSIO and all component. This is my home-assistant.log file: 2019-08-26 19:41:25 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for shelly 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-08-26 19:41:25 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for hacs 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-08-26 19:42:00 INFO (SyncWorker_10) [pyShelly] Init pyShelly 0.0.34 have you got some news?

hakana commented 5 years ago

No, it is very strange. I have done lots of installations and for me it work every time ;(

woody4165 commented 5 years ago

Hi @hakana

I've just completed a clean install of Hassio (the image downloaded) on a RPI3 and added HACS and then this component. I've placed just shelly: in configuration.yaml

I've left turned on all night, but I don't find any shelly entity.

Since there are some people having the issue and the most does not have, maybe there is something in common that prevent the COAP communication.

Router? Network type? Repeater?

I have a Fritz 7590 where Hassio (test on RPi3 and production on Intel NUC) are connected via cable.

I have an OpenWRT Access Point where all the Shellies are connected.

Thanks

errecla commented 5 years ago

Dear woody4165, with witch version of ShellyForHASS do you working? I have identical problem about you. My configuration is:

I try a new last Hassio version in a second Rpi only with ShellyForHASS. Until version 0.0.14 I see shelly devices but offline. If I upgrade to new version I don't see any shelly devices. Claudio

woody4165 commented 5 years ago

Mine is

As hardware an Intel NUC i3

errecla commented 5 years ago

My friends I have good news: I install home assistant on Rasbian and, first of all ShellyForHASS from HACS: It works correctly with all of my shelly devices!!!! then I install Mosquitto MQTT broker and another add on and all works correctly. now, my question is: the problem could be Hassio?