Cheaterdev / clear_grass-ha

Xiaomi ClearGrass Air Detector integration into Home Assistant
59 stars 18 forks source link

Platform not found: sensor.clear_grass #1

Open almirus opened 5 years ago

almirus commented 5 years ago

Hi! Try to install https://github.com/Cheaterdev/clear_grass-ha 7 I have create dir C:\Documents and Settings\USER\Application Data.homeassistant\custom_components\clear_grass and copy two files init.py and sensor.py And edit configuration.yaml sensor:

Weather prediction

But get error 2019-05-27 23:36:05 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for clear_grass 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-05-27 23:43:31 ERROR (MainThread) [homeassistant.components.homeassistant] Platform not found: sensor.clear_grass

Cheaterdev commented 5 years ago

What's your Home Assistant version? From 0.91 version HA uses another components folder structure and this integration fits it. If you version of HA below 0.91 - this component will not work and may give you a such error.

almirus commented 5 years ago

0.93.2

Cheaterdev commented 5 years ago

Is custom_components folder in same config folder where configuration.yaml stores? Any other custom components working? Is there any python_cache folder automatically creates for any of the components?

almirus commented 5 years ago

yep image

Cheaterdev commented 5 years ago

Ok, just installed fresh HA on Windows and copied files from github just as you've did.

My configuration.yaml: https://ideone.com/ZxZi4O

Resulting files: <...>.homeassistant\custom_components\cleargrass\ init .py (without spaces)_ <...>.homeassistant\custom_components\clear_grass\sensor.py

And no errors in log, just info about 3rd party integration.

almirus commented 5 years ago

same https://gist.github.com/almirus/e04545e3bbeb8a991b0ae8482d3e06fb

for example, if the token (or ip) is not correct, what message will i get?

Cheaterdev commented 5 years ago

Currently there is no error message if token/ip is wrong. I used config entirely as i showed here without any modifications. IP is not real, token is test. And it was tested on my work PC where HA wasn't installed before. And there is no Clear Grass device in network. Mybe try delete py_cache?

almirus commented 5 years ago

previously deleted this folder, nothing helps :(

Cheaterdev commented 5 years ago

Can you make archive of entire .homeassistant folder? I'll try to start it.

almirus commented 5 years ago

https://www.dropbox.com/s/etezl1pd7tsyivv/homeassistant.7z?dl=0

Cheaterdev commented 5 years ago

2019-06-13 15:50:12 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for clear_grass 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. Only this one row.

Maybe try to use it on llinux os?

almirus commented 5 years ago

same on debian

image

2019-06-13 23:47:19 ERROR (MainThread) [homeassistant.components.homeassistant] Platform not found: sensor.clear_grass

ShAndrei commented 5 years ago

I had the same problem. Need add file "manifest.json" in folder with custom component files. Home Assistant 0.94.4

Cheaterdev commented 5 years ago

Added manifest. May work now, but in 0.95.1 still works without manifest.

ShAndrei commented 5 years ago

I install Home Assistant 0.95.4. today on Rasberry Pi (Raspbian OS) and got the error described earlier: "2019-07-07 09:06:51 ERROR (MainThread) [homeassistant.components.homeassistant] Platform not found: sensor.clear_grass" Access rights: права Log: 019-07-07 10:43:22 INFO (MainThread) [homeassistant.setup] Setup of domain logger took 0.0 seconds. 2019-07-07 10:43:22 INFO (MainThread) [homeassistant.setup] Setting up http 2019-07-07 10:43:22 INFO (MainThread) [homeassistant.setup] Setup of domain http took 0.0 seconds. 2019-07-07 10:43:22 INFO (MainThread) [homeassistant.setup] Setting up system_log 2019-07-07 10:43:22 INFO (MainThread) [homeassistant.setup] Setup of domain system_log took 0.0 seconds. 2019-07-07 10:43:22 INFO (MainThread) [homeassistant.setup] Setting up recorder 2019-07-07 10:43:23 INFO (MainThread) [homeassistant.setup] Setup of domain recorder took 1.0 seconds. 2019-07-07 10:43:23 INFO (MainThread) [homeassistant.setup] Setting up lovelace 2019-07-07 10:43:23 INFO (MainThread) [homeassistant.setup] Setup of domain lovelace took 0.0 seconds. 2019-07-07 10:43:23 INFO (MainThread) [homeassistant.setup] Setting up updater 2019-07-07 10:43:23 INFO (MainThread) [homeassistant.setup] Setup of domain updater took 0.0 seconds. 2019-07-07 10:43:23 INFO (MainThread) [homeassistant.setup] Setting up sun 2019-07-07 10:43:23 INFO (MainThread) [homeassistant.setup] Setup of domain sun took 0.1 seconds. 2019-07-07 10:43:23 INFO (MainThread) [homeassistant.setup] Setting up group 2019-07-07 10:43:23 INFO (MainThread) [homeassistant.setup] Setup of domain group took 0.0 seconds. 2019-07-07 10:43:24 INFO (MainThread) [homeassistant.setup] Setting up ssdp 2019-07-07 10:43:24 INFO (MainThread) [homeassistant.setup] Setup of domain ssdp took 0.0 seconds. 2019-07-07 10:43:24 INFO (MainThread) [homeassistant.setup] Setting up met 2019-07-07 10:43:24 INFO (MainThread) [homeassistant.setup] Setup of domain met took 0.0 seconds. 2019-07-07 10:43:24 INFO (SyncWorker_2) [homeassistant.loader] Loaded clear_grass from custom_components.clear_grass 2019-07-07 10:43:24 INFO (MainThread) [homeassistant.setup] Setting up modbus 2019-07-07 10:43:24 INFO (MainThread) [homeassistant.setup] Setting up person 2019-07-07 10:43:24 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for clear_grass 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-07 10:43:24 INFO (MainThread) [homeassistant.setup] Setting up sensor 2019-07-07 10:43:25 INFO (MainThread) [homeassistant.setup] Setting up api 2019-07-07 10:43:25 INFO (MainThread) [homeassistant.setup] Setting up websocket_api 2019-07-07 10:43:25 INFO (MainThread) [homeassistant.setup] Setup of domain websocket_api took 0.0 seconds. 2019-07-07 10:43:25 INFO (MainThread) [homeassistant.setup] Setting up script 2019-07-07 10:43:25 INFO (MainThread) [homeassistant.setup] Setup of domain script took 0.0 seconds. 2019-07-07 10:43:25 INFO (MainThread) [homeassistant.setup] Setting up auth 2019-07-07 10:43:25 INFO (MainThread) [homeassistant.setup] Setup of domain auth took 0.0 seconds. 2019-07-07 10:43:25 INFO (MainThread) [homeassistant.setup] Setting up history 2019-07-07 10:43:25 INFO (MainThread) [homeassistant.setup] Setup of domain history took 0.0 seconds. 2019-07-07 10:43:25 INFO (MainThread) [homeassistant.setup] Setting up config 2019-07-07 10:43:25 INFO (MainThread) [homeassistant.setup] Setting up webhook 2019-07-07 10:43:25 INFO (MainThread) [homeassistant.setup] Setup of domain webhook took 0.0 seconds. 2019-07-07 10:43:25 INFO (MainThread) [homeassistant.setup] Setting up system_health 2019-07-07 10:43:25 INFO (MainThread) [homeassistant.setup] Setup of domain system_health took 0.0 seconds. 2019-07-07 10:43:25 INFO (MainThread) [homeassistant.setup] Setup of domain api took 0.4 seconds. 2019-07-07 10:43:25 INFO (SyncWorker_8) [homeassistant.loader] Loaded weather from homeassistant.components.weather 2019-07-07 10:43:25 INFO (SyncWorker_11) [homeassistant.loader] Loaded google_translate from homeassistant.components.google_translate 2019-07-07 10:43:25 INFO (MainThread) [homeassistant.setup] Setting up onboarding 2019-07-07 10:43:25 INFO (MainThread) [homeassistant.setup] Setup of domain modbus took 1.3 seconds. 2019-07-07 10:43:25 INFO (MainThread) [homeassistant.setup] Setup of domain config took 0.1 seconds. 2019-07-07 10:43:25 INFO (MainThread) [homeassistant.setup] Setting up automation 2019-07-07 10:43:25 INFO (MainThread) [homeassistant.setup] Setup of domain automation took 0.0 seconds. 2019-07-07 10:43:26 INFO (MainThread) [homeassistant.setup] Setting up mobile_app 2019-07-07 10:43:26 INFO (MainThread) [homeassistant.setup] Setting up cloud 2019-07-07 10:43:27 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.modbus 2019-07-07 10:43:27 INFO (MainThread) [homeassistant.setup] Setting up zeroconf 2019-07-07 10:43:27 INFO (MainThread) [homeassistant.setup] Setting up weather 2019-07-07 10:43:27 INFO (MainThread) [homeassistant.setup] Setup of domain weather took 0.0 seconds. 2019-07-07 10:43:27 INFO (MainThread) [homeassistant.setup] Setting up tts 2019-07-07 10:43:28 INFO (MainThread) [homeassistant.components.weather] Setting up weather.met 2019-07-07 10:43:28 INFO (MainThread) [homeassistant.setup] Setup of domain mobile_app took 1.8 seconds. 2019-07-07 10:43:28 INFO (MainThread) [homeassistant.setup] Setup of domain onboarding took 2.5 seconds. 2019-07-07 10:43:28 INFO (MainThread) [homeassistant.setup] Setup of domain cloud took 1.8 seconds. 2019-07-07 10:43:28 INFO (MainThread) [homeassistant.setup] Setting up frontend 2019-07-07 10:43:28 INFO (MainThread) [homeassistant.setup] Setup of domain frontend took 0.0 seconds. 2019-07-07 10:43:28 INFO (MainThread) [homeassistant.setup] Setup of domain tts took 0.3 seconds. 2019-07-07 10:43:28 INFO (SyncWorker_8) [homeassistant.loader] Loaded notify from homeassistant.components.notify 2019-07-07 10:43:28 INFO (MainThread) [homeassistant.setup] Setting up map 2019-07-07 10:43:28 INFO (MainThread) [homeassistant.setup] Setup of domain map took 0.0 seconds. 2019-07-07 10:43:28 INFO (MainThread) [homeassistant.setup] Setting up logbook 2019-07-07 10:43:28 INFO (MainThread) [homeassistant.setup] Setup of domain logbook took 0.0 seconds. 2019-07-07 10:43:28 INFO (MainThread) [homeassistant.setup] Setup of domain person took 3.9 seconds. 2019-07-07 10:43:28 INFO (MainThread) [homeassistant.setup] Setting up notify 2019-07-07 10:43:28 INFO (MainThread) [homeassistant.setup] Setup of domain notify took 0.0 seconds. 2019-07-07 10:43:28 INFO (MainThread) [homeassistant.setup] Setup of domain sensor took 3.8 seconds. 2019-07-07 10:43:28 INFO (MainThread) [homeassistant.components.notify] Setting up notify.mobile_app 2019-07-07 10:43:29 INFO (MainThread) [homeassistant.setup] Setup of domain zeroconf took 1.3 seconds. 2019-07-07 10:43:29 INFO (MainThread) [homeassistant.setup] Setting up default_config 2019-07-07 10:43:29 INFO (MainThread) [homeassistant.setup] Setup of domain default_config took 0.0 seconds. 2019-07-07 10:43:31 INFO (MainThread) [homeassistant.bootstrap] Home Assistant initialized in 9.88s 2019-07-07 10:43:31 INFO (MainThread) [homeassistant.core] Starting Home Assistant 2019-07-07 10:43:31 INFO (MainThread) [homeassistant.core] Timer:starting 2019-07-07 10:43:34 INFO (SyncWorker_4) [homeassistant.loader] Loaded iqvia from homeassistant.components.iqvia 2019-07-07 10:43:35 INFO (SyncWorker_16) [homeassistant.loader] Loaded emulated_roku from homeassistant.components.emulated_roku 2019-07-07 10:43:35 INFO (SyncWorker_4) [homeassistant.loader] Loaded ambient_station from homeassistant.components.ambient_station 2019-07-07 10:43:35 INFO (SyncWorker_3) [homeassistant.loader] Loaded smartthings from homeassistant.components.smartthings 2019-07-07 10:43:35 INFO (SyncWorker_17) [homeassistant.loader] Loaded tradfri from homeassistant.components.tradfri 2019-07-07 10:43:35 INFO (SyncWorker_11) [homeassistant.loader] Loaded ifttt from homeassistant.components.ifttt 2019-07-07 10:43:35 INFO (SyncWorker_1) [homeassistant.loader] Loaded rainmachine from homeassistant.components.rainmachine 2019-07-07 10:43:35 INFO (SyncWorker_15) [homeassistant.loader] Loaded cast from homeassistant.components.cast 2019-07-07 10:43:35 INFO (SyncWorker_6) [homeassistant.loader] Loaded smhi from homeassistant.components.smhi 2019-07-07 10:43:35 INFO (SyncWorker_19) [homeassistant.loader] Loaded ambiclimate from homeassistant.components.ambiclimate 2019-07-07 10:43:35 INFO (SyncWorker_5) [homeassistant.loader] Loaded zha from homeassistant.components.zha 2019-07-07 10:43:35 INFO (SyncWorker_16) [homeassistant.loader] Loaded somfy from homeassistant.components.somfy 2019-07-07 10:43:35 INFO (SyncWorker_4) [homeassistant.loader] Loaded dialogflow from homeassistant.components.dialogflow 2019-07-07 10:43:35 INFO (SyncWorker_3) [homeassistant.loader] Loaded hue from homeassistant.components.hue 2019-07-07 10:43:35 INFO (SyncWorker_17) [homeassistant.loader] Loaded geofency from homeassistant.components.geofency 2019-07-07 10:43:35 INFO (SyncWorker_11) [homeassistant.loader] Loaded openuv from homeassistant.components.openuv 2019-07-07 10:43:35 INFO (SyncWorker_1) [homeassistant.loader] Loaded sonos from homeassistant.components.sonos 2019-07-07 10:43:35 INFO (SyncWorker_15) [homeassistant.loader] Loaded twilio from homeassistant.components.twilio 2019-07-07 10:43:35 INFO (SyncWorker_13) [homeassistant.loader] Loaded axis from homeassistant.components.axis 2019-07-07 10:43:35 INFO (SyncWorker_19) [homeassistant.loader] Loaded plaato from homeassistant.components.plaato 2019-07-07 10:43:35 INFO (SyncWorker_5) [homeassistant.loader] Loaded esphome from homeassistant.components.esphome 2019-07-07 10:43:35 INFO (SyncWorker_16) [homeassistant.loader] Loaded homekit_controller from homeassistant.components.homekit_controller 2019-07-07 10:43:35 INFO (SyncWorker_4) [homeassistant.loader] Loaded logi_circle from homeassistant.components.logi_circle 2019-07-07 10:43:35 INFO (SyncWorker_3) [homeassistant.loader] Loaded locative from homeassistant.components.locative 2019-07-07 10:43:35 INFO (SyncWorker_17) [homeassistant.loader] Loaded tplink from homeassistant.components.tplink 2019-07-07 10:43:35 INFO (SyncWorker_11) [homeassistant.loader] Loaded nest from homeassistant.components.nest 2019-07-07 10:43:35 INFO (SyncWorker_1) [homeassistant.loader] Loaded luftdaten from homeassistant.components.luftdaten 2019-07-07 10:43:35 INFO (SyncWorker_15) [homeassistant.loader] Loaded tellduslive from homeassistant.components.tellduslive 2019-07-07 10:43:35 INFO (SyncWorker_13) [homeassistant.loader] Loaded mailgun from homeassistant.components.mailgun 2019-07-07 10:43:35 INFO (SyncWorker_19) [homeassistant.loader] Loaded upnp from homeassistant.components.upnp 2019-07-07 10:43:35 INFO (SyncWorker_5) [homeassistant.loader] Loaded gpslogger from homeassistant.components.gpslogger 2019-07-07 10:43:35 INFO (SyncWorker_16) [homeassistant.loader] Loaded heos from homeassistant.components.heos 2019-07-07 10:43:35 INFO (SyncWorker_4) [homeassistant.loader] Loaded point from homeassistant.components.point 2019-07-07 10:43:35 INFO (SyncWorker_3) [homeassistant.loader] Loaded hangouts from homeassistant.components.hangouts 2019-07-07 10:43:35 INFO (SyncWorker_17) [homeassistant.loader] Loaded zone from homeassistant.components.zone 2019-07-07 10:43:35 INFO (SyncWorker_11) [homeassistant.loader] Loaded simplisafe from homeassistant.components.simplisafe 2019-07-07 10:43:35 INFO (SyncWorker_1) [homeassistant.loader] Loaded zwave from homeassistant.components.zwave 2019-07-07 10:43:35 INFO (SyncWorker_15) [homeassistant.loader] Loaded daikin from homeassistant.components.daikin 2019-07-07 10:43:35 INFO (SyncWorker_13) [homeassistant.loader] Loaded ps4 from homeassistant.components.ps4 2019-07-07 10:43:35 INFO (SyncWorker_19) [homeassistant.loader] Loaded toon from homeassistant.components.toon 2019-07-07 10:43:35 INFO (SyncWorker_18) [homeassistant.loader] Loaded ios from homeassistant.components.ios 2019-07-07 10:43:35 INFO (SyncWorker_16) [homeassistant.loader] Loaded ipma from homeassistant.components.ipma 2019-07-07 10:43:35 INFO (SyncWorker_4) [homeassistant.loader] Loaded unifi from homeassistant.components.unifi 2019-07-07 10:43:35 INFO (SyncWorker_3) [homeassistant.loader] Loaded deconz from homeassistant.components.deconz 2019-07-07 10:43:35 INFO (SyncWorker_17) [homeassistant.loader] Loaded wemo from homeassistant.components.wemo 2019-07-07 10:43:35 INFO (SyncWorker_11) [homeassistant.loader] Loaded homematicip_cloud from homeassistant.components.homematicip_cloud 2019-07-07 10:43:35 INFO (SyncWorker_1) [homeassistant.loader] Loaded lifx from homeassistant.components.lifx 2019-07-07 10:43:35 INFO (SyncWorker_15) [homeassistant.loader] Loaded life360 from homeassistant.components.life360 2019-07-07 10:43:35 INFO (SyncWorker_13) [homeassistant.loader] Loaded owntracks from homeassistant.components.owntracks 2019-07-07 10:43:35 INFO (SyncWorker_19) [homeassistant.loader] Loaded adguard from homeassistant.components.adguard 2019-07-07 10:43:35 INFO (SyncWorker_18) [homeassistant.loader] Loaded mqtt from homeassistant.components.mqtt 2019-07-07 10:48:42 ERROR (MainThread) [homeassistant.components.homeassistant] Platform not found: sensor.clear_grass

Configuration.yaml (working on windows 10): https://www.dropbox.com/s/lsbo2evawqlk5w3/Configuration.yaml?dl=0 Need your help.

Cheaterdev commented 5 years ago

I've installed on fresh RPI3B+ Raspbian. And found that integration doesnt work too. But without that error. After some investigation i found, that xiaomi_miio library is not presented by default. Added to manifest. Works now.

Try updating manifest.json

ShAndrei commented 5 years ago

This did not help. Maybe the reason is how HA installing. Have you installed in virtual environment? I installed HA using this instruction https://www.home-assistant.io/docs/installation/raspberry-pi/.

ShAndrei commented 5 years ago

The error occurs when i check the configuration file. Download passes without errors. configuration_check

Cheaterdev commented 5 years ago

Same instructions. Try restart Home Assistant normally, from teminal or restart Raspberry.

Cheaterdev commented 5 years ago

Also try https://www.home-assistant.io/components/sensor.xiaomi_miio/. My integration is almost the same, so errors with setup must be the same.

ShAndrei commented 5 years ago

Working now. When i added sensor: - platform: xiaomi_miio in configuration file, needed files was installed.

Thanks for help.

minsuke commented 5 years ago

Thx for your great code. But I have question AQI and PM2.5 is same Value ? I think this looks same value in your coding

Cheaterdev commented 5 years ago

Thx for your great code. But I have question AQI and PM2.5 is same Value ? I think this looks same value in your coding Yes, it's same. Origin of this code is from official Xiaomi PM25 Air Quality Monitor, so the main state of sensor is PM2.5.

GreyEarl commented 5 years ago

I struggled several weeks with this. I use the latest Hassbian. The xiaomi_miio platform works like it should, but the custom component refuses to work. These are the errors I see:

1:40 custom_components/clear_grass/sensor.py (ERROR) unable to parse json '': Expecting value: line 1 column 1 (char 0)

Error while setting up platform clear_grass

Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py", line 126, in _async_setup_platform
    SLOW_SETUP_MAX_WAIT)
  File "/usr/lib/python3.7/asyncio/tasks.py", line 416, in wait_for
    return fut.result()
  File "/home/homeassistant/.homeassistant/custom_components/clear_grass/sensor.py", line 260, in async_setup_platform
    device_info = air_quality_monitor.info()
  File "/srv/homeassistant/lib/python3.7/site-packages/miio/device.py", line 329, in info
    return DeviceInfo(self.send("miIO.info"))
  File "/srv/homeassistant/lib/python3.7/site-packages/miio/device.py", line 265, in send
    self.__id = m.data.value["id"]
TypeError: 'NoneType' object is not subscriptable

@ShAndrei: I don't understand how you solved the issue. Can you elaborate a bit more?

GreyEarl commented 5 years ago

Anyone?

GreyEarl commented 5 years ago

Tried a fresh RPI3B+ Raspbian aswell. Same issue as above.

GreyEarl commented 5 years ago

Alright, problem finally fixed. For the ones who have the same issue. During the first initialization/registration of the ClearGrass monitor, the device needs to have a working internet connection. I had blocked internet access for the device. In addition to that I have a PiHole server running. So that was a bad combo.

After registering the device in Home Assistant you can block access and enable PiHole filtering again.