maheus / fumis_integration

Homeassistant Fumis Integration
10 stars 3 forks source link

Fumis integração #2

Closed rmpirescosta closed 3 years ago

rmpirescosta commented 3 years ago

I did the integration without any problems, but no entities or devices appear to me, as I do to interact with the Fumis. I remember that I am not experienced in these things as a home assistant. 16097159519504925366142534391664

maheus commented 3 years ago

ok , you should have six entities . In HA UI you have logs (configurations -> Logs), do you can extract it ? Warning there is maybe users/passwords in so you must delete it

rmpirescosta commented 3 years ago

LOGS Logger: homeassistant.components.sensor Source: custom_components/fumis/fumis/fumis.py:87 Integration: Sensor (documentation, issues) First occurred: 10:37:33 (5 occurrences) Last logged: 10:37:34

fumis: Error on device update! Traceback (most recent call last): File "/config/custom_components/fumis/fumis/fumis.py", line 77, in _request response.raise_for_status() File "/usr/local/lib/python3.8/site-packages/aiohttp/client_reqrep.py", line 1002, in raise_for_status raise ClientResponseError( aiohttp.client_exceptions.ClientResponseError: 401, message='Unauthorized', url=URL('http://api.fumis.si/v1/status/')

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 359, in _async_add_entity await entity.async_device_update(warning=False) File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 466, in async_device_update await task File "/config/custom_components/fumis/sensor.py", line 140, in async_update self.info = await self.fumis.update_info() File "/config/custom_components/fumis/fumis/fumis.py", line 117, in update_info raise exception File "/config/custom_components/fumis/fumis/fumis.py", line 114, in update_info data = await self._request("status") File "/config/custom_components/fumis/fumis/fumis.py", line 87, in _request raise FumisConnectionError( custom_components.fumis.fumis.exceptions.FumisConnectionError: Error occurred while communicating with to the Fumis WiRCU API

maheus commented 3 years ago

ok error 401, when you had added your fumis integration do you have enter fumis mac address and your fumis password ? ( normally 4 digit)

rmpirescosta commented 3 years ago

yes I added the mac and the pin. I tested with the following mac formats 00: 00: 00: 00 ..... and also with 000000 ... without any success

maheus commented 3 years ago

ok format is 00000... , i will added an help. if you have curl , can you test this command curl -H 'username:YOUR_MAC' -H 'password:YOUR_PIN' https://api.fumis.si/v1/status/

the response should be an json object

{"apiVersion":"1.3","unit"
....
maheus commented 3 years ago

the same test , can be done with Postman

rmpirescosta commented 3 years ago

I did a rest to everything and installed it again from the beginning and now yes 6 entities.

maheus commented 3 years ago

cool, the fumis api is not always stable . I think they have not workers the saturdays and the sundays.

maheus commented 3 years ago

@rmpirescosta do you can say me if all functionnalities are ok ? on/off, sensors and changing temperature ?

rmpirescosta commented 3 years ago

I've been testing. for now the only one that works is the on / off. both the temperature and the rest of the functions do not work. it can also be due to my pellet boiler being central heating not air like most

maheus commented 3 years ago

yes it's possible, i think the datas are different.
I can change the code but i need more informations.
do you can used ngrep on linux or wireshark on windows for capture data traffic to api.fumis.si.
You must change the file custom_components/fumis/fumis/fumis.py to change the destination port lines 52/53

52             #scheme="https", host="api.fumis.si", port=443, path="/v1/"$
53             scheme="http", host="api.fumis.si", port=80, path="/v1/"$

start traffic capture and after that restart HA. Warning there is maybe users/passwords in so you must delete it

maheus commented 3 years ago

or if you have curl , can you test this command curl -H 'username:YOUR_MAC' -H 'password:YOUR_PIN' https://api.fumis.si/v1/status/

samovesel commented 3 years ago

If you want to make everything work (temperature / power / on-off state, parameters) you have to include version in unit part, like this:

 {
     "apiVersion": "1",
     "unit": {
         "id": "XXXXXXXXXXXX",
         "pin": "XXXX",
         "type": 0,
         "version": "2.3.0"
     },
     "controller": {
         "temperatures": [
             {
                 "set": 75,
                 "id": 6
             }
         ],
         "type": 0
     }
 }

If you want to set temperature, you should first find temperature id and change the code accordingly. You can also change all available service parameters (look here, page 28 and on). Guys who wrote that manual were nice enough also to include instructions to access service parameters through keyboard ;) To change service parameters just send something like this:

 {
     "apiVersion": "1",
     "controller": {
         "diagnostic": {
             "parameters": [
                 {
                 "id": 70,
                 "value": 149
                 }
             ]
         }
     },
     "unit": {
         "id": "XXXXXXXXXXXX",
         "pin": "XXXX",
         "version": "2.3.0"
     }
 }
rmpirescosta commented 3 years ago

Good afternoon is fumis integration still working with these latest home assistant updates?

maheus commented 3 years ago

yes @rmpirescosta , for the moment this integration it is still functionnal with latest homeassistant version

rmpirescosta commented 3 years ago

The one I had installed stopped working. I walk around here butts with her but I can't do anything. no entities appear. is there an explanation or is it even stupid on my part

rmpirescosta commented 3 years ago

@maheus, the entities don't appear to me at all

samovesel commented 3 years ago

The one I had installed stopped working. I walk around here butts with her but I can't do anything. no entities appear. is there an explanation or is it even stupid on my part

I'm not sure whether it has anything to do with entities, but fumis changed something during upgrade this weekend and now MAC address MUST be set in ALL CAPS, if you have MAC set in small caps, the connection won't work anymore.

maheus commented 3 years ago

I not have a problem in my side , but my mac is set in ALL CAPS. thanks @samovesel ( it is simple to change )

rmpirescosta commented 3 years ago

I've tested it both ways and nothing... which files should I use for sure. can send a link. I'm already confused with the versions.

maheus commented 3 years ago

@rmpirescosta do you have tested this command ? (api.fumis.si is perhaps down)

if you have curl , can you test this command
curl -H 'username:YOUR_MAC' -H 'password:YOUR_PIN' https://api.fumis.si/v1/status/
rmpirescosta commented 3 years ago

C:\Users\Rui Costa>curl -H 'username:0016D000++++' -H 'password:++++' https://api.fumis.si/v1/status/ {"message":"A unit controller with that mac and pin doesn't exist","code":401}

@maheus this error appeared I wrote the command well

maheus commented 3 years ago

i'm not familiar with windows curl but the command seems good. But the result is not normal. Do you have test with the fumis android application ?

samovesel commented 3 years ago

@rmpirescosta try without quotation marks: curl -H username:0016D000++++ -H password:++++ https://api.fumis.si/v1/status/

C:\Users\Rui Costa>curl -H 'username:0016D000++++' -H 'password:++++' https://api.fumis.si/v1/status/ {"message":"A unit controller with that mac and pin doesn't exist","code":401}

@maheus this error appeared I wrote the command well

rmpirescosta commented 3 years ago

@samovesel is this {"apiVersion":"1.3","unit":{"id":"0016D0XXXXX","type":0,"version":"2.3.0","command":null,"rssi":"-43","ip":"192.168.1.123","timezone":null,"temperature":31},"controller":{"type":0,"version":"1.6.12","command":1,"status":0,"heatingSlope":null,"stoveLastAvailability":1634572110,"mobileLastAvailability":1634569930,"currentTime":1634572144,"error":0,"alert":0,"timerEnable":false,"fuelType":1,"timeToService":-1,"delayedStartAt":-1,"delayedStopAt":-1,"power":{"setType":1,"actualType":1,"kw":0,"actualPower":0,"setPower":5},"antifreeze":{"temperature":null,"enable":false},"statistic":{"igniterStarts":497,"uptime":15614280,"heatingTime":5135580,"serviceTime":5123640,"overheatings":0,"misfires":31,"fuelQuantityUsed":0},"diagnostic":{"parameters":[{"id":0,"value":20},{"id":1,"value":5},{"id":2,"value":0},{"id":3,"value":160},{"id":4,"value":100},{"id":5,"value":120},{"id":6,"value":35},{"id":7,"value":100},{"id":8,"value":55},{"id":9,"value":1},{"id":10,"value":31},{"id":11,"value":1},{"id":12,"value":1},{"id":13,"value":1},{"id":14,"value":1},{"id":15,"value":1},{"id":16,"value":1},{"id":17,"value":1},{"id":18,"value":39},{"id":19,"value":240},{"id":20,"value":190},{"id":21,"value":150},{"id":22,"value":156},{"id":23,"value":171},{"id":24,"value":170},{"id":25,"value":1},{"id":26,"value":1},{"id":27,"value":1},{"id":28,"value":215},{"id":29,"value":0},{"id":30,"value":0},{"id":31,"value":0},{"id":32,"value":0},{"id":33,"value":0},{"id":34,"value":0},{"id":35,"value":0},{"id":36,"value":0},{"id":37,"value":0},{"id":38,"value":0},{"id":39,"value":0},{"id":40,"value":240},{"id":41,"value":240},{"id":42,"value":240},{"id":43,"value":240},{"id":44,"value":240},{"id":45,"value":240},{"id":46,"value":240},{"id":47,"value":240},{"id":48,"value":240},{"id":49,"value":240},{"id":50,"value":1},{"id":51,"value":58},{"id":52,"value":0},{"id":53,"value":0},{"id":54,"value":61},{"id":55,"value":200},{"id":56,"value":80},{"id":57,"value":200},{"id":58,"value":0},{"id":59,"value":50},{"id":60,"value":30},{"id":61,"value":20},{"id":62,"value":230},{"id":63,"value":0},{"id":64,"value":0},{"id":65,"value":0},{"id":66,"value":0},{"id":67,"value":56},{"id":68,"value":53},{"id":69,"value":0},{"id":70,"value":210},{"id":71,"value":6},{"id":72,"value":2},{"id":73,"value":100},{"id":74,"value":100},{"id":75,"value":100},{"id":76,"value":4},{"id":77,"value":0},{"id":78,"value":0},{"id":79,"value":0},{"id":80,"value":0},{"id":81,"value":0},{"id":82,"value":0},{"id":83,"value":0},{"id":84,"value":0},{"id":85,"value":0},{"id":86,"value":0},{"id":87,"value":0},{"id":88,"value":0},{"id":89,"value":0},{"id":90,"value":0},{"id":91,"value":0},{"id":92,"value":1},{"id":93,"value":1},{"id":94,"value":0},{"id":95,"value":0},{"id":96,"value":0},{"id":97,"value":0},{"id":98,"value":0},{"id":99,"value":0},{"id":100,"value":0},{"id":101,"value":255},{"id":102,"value":0},{"id":103,"value":0},{"id":104,"value":0},{"id":105,"value":0}],"variables":[{"id":0,"value":2},{"id":1,"value":16416},{"id":2,"value":0},{"id":3,"value":0},{"id":4,"value":0},{"id":5,"value":5},{"id":6,"value":0},{"id":7,"value":0},{"id":8,"value":53},{"id":9,"value":0},{"id":10,"value":0},{"id":11,"value":59},{"id":12,"value":0},{"id":13,"value":497},{"id":14,"value":18},{"id":15,"value":4337},{"id":16,"value":33},{"id":17,"value":1426},{"id":18,"value":33},{"id":19,"value":1426},{"id":20,"value":0},{"id":21,"value":31},{"id":22,"value":0},{"id":23,"value":15},{"id":24,"value":47},{"id":25,"value":16},{"id":26,"value":7},{"id":27,"value":17},{"id":28,"value":10},{"id":29,"value":21},{"id":30,"value":1},{"id":31,"value":0},{"id":32,"value":0},{"id":33,"value":0},{"id":34,"value":0},{"id":35,"value":0},{"id":36,"value":0},{"id":37,"value":248},{"id":38,"value":20201121},{"id":39,"value":1025},{"id":40,"value":1},{"id":41,"value":253},{"id":42,"value":20201130},{"id":43,"value":815},{"id":44,"value":2},{"id":45,"value":248},{"id":46,"value":20210127},{"id":47,"value":1632},{"id":48,"value":3},{"id":49,"value":253},{"id":50,"value":20210205},{"id":51,"value":1841},{"id":52,"value":4},{"id":53,"value":248},{"id":54,"value":20210217},{"id":55,"value":1430},{"id":56,"value":5},{"id":57,"value":253},{"id":58,"value":20210221},{"id":59,"value":1638},{"id":60,"value":6},{"id":61,"value":248},{"id":62,"value":20200115},{"id":63,"value":1701},{"id":64,"value":7},{"id":65,"value":253},{"id":66,"value":20200116},{"id":67,"value":1219},{"id":68,"value":8},{"id":69,"value":248},{"id":70,"value":20200119},{"id":71,"value":1207},{"id":72,"value":9},{"id":73,"value":253},{"id":74,"value":20200120},{"id":75,"value":812},{"id":76,"value":10},{"id":77,"value":248},{"id":78,"value":20200215},{"id":79,"value":1016},{"id":80,"value":11},{"id":81,"value":253},{"id":82,"value":20200217},{"id":83,"value":747},{"id":84,"value":12},{"id":85,"value":253},{"id":86,"value":20000101},{"id":87,"value":633},{"id":88,"value":13},{"id":89,"value":248},{"id":90,"value":20000327},{"id":91,"value":450},{"id":92,"value":14},{"id":93,"value":253},{"id":94,"value":20000420},{"id":95,"value":48},{"id":96,"value":0},{"id":97,"value":0},{"id":98,"value":0},{"id":99,"value":0}],"timers":[{"id":0,"value":16},{"id":1,"value":0},{"id":2,"value":1},{"id":3,"value":5},{"id":4,"value":6},{"id":5,"value":0},{"id":6,"value":9},{"id":7,"value":0},{"id":8,"value":0},{"id":9,"value":0},{"id":10,"value":0},{"id":11,"value":0},{"id":12,"value":12},{"id":13,"value":0},{"id":14,"value":14},{"id":15,"value":30},{"id":16,"value":1},{"id":17,"value":2},{"id":18,"value":1},{"id":19,"value":2},{"id":20,"value":1},{"id":21,"value":2},{"id":22,"value":1},{"id":23,"value":2},{"id":24,"value":1},{"id":25,"value":2},{"id":26,"value":1},{"id":27,"value":2},{"id":28,"value":1},{"id":29,"value":2},{"id":30,"value":16},{"id":31,"value":0},{"id":32,"value":21},{"id":33,"value":0},{"id":34,"value":17},{"id":35,"value":30},{"id":36,"value":22},{"id":37,"value":30},{"id":38,"value":0},{"id":39,"value":0},{"id":40,"value":0},{"id":41,"value":0},{"id":42,"value":0},{"id":43,"value":0},{"id":44,"value":0},{"id":45,"value":590},{"id":46,"value":590},{"id":47,"value":0},{"id":48,"value":800},{"id":49,"value":800},{"id":50,"value":800}]},"ecoMode":{"ecoModeSetType":0,"ecoModeEnable":0},"hybrid":{"actualType":0,"operation":0,"state":0},"fans":[{"weight":0,"speedType":0,"speed":0,"id":1}],"fuels":[{"name":null,"quality":1,"qualityType":3,"qualityActual":null,"quantitySetType":0,"quantityActualType":0,"quantity":null,"quantityDisplay":1,"id":1}],"temperatures":[{"name":null,"weight":0,"setType":0,"actualType":0,"onMainScreen":false,"actual":0,"set":0,"id":9},{"name":null,"weight":0,"setType":0,"actualType":0,"onMainScreen":false,"actual":0,"set":0,"id":2},{"name":null,"weight":0,"setType":0,"actualType":0,"onMainScreen":false,"actual":0,"set":0,"id":7},{"name":null,"weight":0,"setType":0,"actualType":0,"onMainScreen":false,"actual":0,"set":0,"id":5},{"name":null,"weight":0,"setType":0,"actualType":0,"onMainScreen":false,"actual":0,"set":0,"id":1},{"name":null,"weight":0,"setType":0,"actualType":0,"onMainScreen":false,"actual":0,"set":0,"id":4},{"name":null,"weight":3,"setType":10,"actualType":10,"onMainScreen":true,"actual":53,"set":58,"id":6},{"name":null,"weight":0,"setType":0,"actualType":0,"onMainScreen":false,"actual":0,"set":0,"id":8},{"name":null,"weight":0,"setType":0,"actualType":0,"onMainScreen":false,"actual":0,"set":0,"id":3}],"timers":[]}}

samovesel commented 3 years ago

@rmpirescosta Yes, this is expected answer from server.

rmpirescosta commented 3 years ago

@samovesel this appeared. however the home assistant does not appear to me any entity. is empty. what will I be doing wrong. I'm using these files to put in the custon_components folder https://github.com/maheus/fumis_integration

maheus commented 3 years ago

do you have any logs in homeassistant.log @rmpirescosta ?

maheus commented 3 years ago

example of my logs

2021-10-15 22:42:02 WARNING (SyncWorker_2) [homeassistant.loader] We found a custom integration fumis which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2021-10-15 22:42:09 INFO (MainThread) [homeassistant.setup] Setting up fumis
2021-10-15 22:42:09 INFO (MainThread) [homeassistant.setup] Setup of domain fumis took 0.0 seconds
2021-10-15 22:42:12 INFO (MainThread) [custom_components.fumis] start fumis
2021-10-15 22:42:16 INFO (MainThread) [homeassistant.components.climate] Setting up climate.fumis
2021-10-15 22:42:27 WARNING (MainThread) [homeassistant.components.climate] Setup of climate platform fumis is taking over 10 seconds.
2021-10-15 22:42:32 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.fumis
2021-10-15 22:42:43 WARNING (MainThread) [homeassistant.components.sensor] Setup of sensor platform fumis is taking over 10 seconds.
2021-10-15 22:43:37 INFO (MainThread) [homeassistant.components.automation.set_fumis_temp] Initialized trigger Set  Fumis Temp
2021-10-15 22:43:39 WARNING (MainThread) [homeassistant.helpers.entity] Update of sensor.fumis_inside_temperature is taking over 10 seconds
2021-10-15 22:43:39 WARNING (MainThread) [homeassistant.helpers.entity] Update of sensor.fumis_power is taking over 10 seconds
2021-10-15 22:43:39 WARNING (MainThread) [homeassistant.helpers.entity] Update of sensor.fumis_actual_power is taking over 10 seconds
2021-10-15 22:43:39 WARNING (MainThread) [homeassistant.helpers.entity] Update of sensor.fumis_stove_state is taking over 10 seconds
2021-10-15 22:43:39 WARNING (MainThread) [homeassistant.helpers.entity] Update of sensor.fumis_pellet_quantity is taking over 10 seconds
rmpirescosta commented 3 years ago

Logger: homeassistant.components.sensor Source: custom_components/fumis/fumis/models.py:97 Integration: Sensor (documentation, issues) First occurred: 17:06:44 (10 occurrences) Last logged: 17:07:58

fumis: Error on device update! Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 431, in _async_add_entity await entity.async_device_update(warning=False) File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 618, in async_device_update await task File "/config/custom_components/fumis/sensor.py", line 140, in async_update self.info = await self.fumis.update_info() File "/config/custom_components/fumis/fumis/fumis.py", line 123, in update_info self.info = Info.from_dict(data) File "/config/custom_components/fumis/fumis/models.py", line 97, in from_dict fuel_quantity=(float(fuel.get("quantity", "Unknown")) * 100), TypeError: float() argument must be a string or a number, not 'NoneType'

Logger: homeassistant.components.climate Source: custom_components/fumis/fumis/models.py:97 Integration: Climatização (documentation, issues) First occurred: 17:06:45 (2 occurrences) Last logged: 17:07:58

fumis: Error on device update! Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 431, in _async_add_entity await entity.async_device_update(warning=False) File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 618, in async_device_update await task File "/config/custom_components/fumis/climate.py", line 142, in async_update self.info = await self.fumis.update_info() File "/config/custom_components/fumis/fumis/fumis.py", line 123, in update_info self.info = Info.from_dict(data) File "/config/custom_components/fumis/fumis/models.py", line 97, in from_dict fuel_quantity=(float(fuel.get("quantity", "Unknown")) * 100), TypeError: float() argument must be a string or a number, not 'NoneType'

maheus commented 3 years ago

ok I understand

"fuels":[{"name":null,"quality":1,"qualityType":3,"qualityActual":null,"quantitySetType":0,"quantityActualType":0,"quantity":null,"quantityDispla

fuel quantity in json is set to null but it must be a float

maheus commented 3 years ago

do you can test this change, open fumis/models.py and add

 76         if fuel.get("quantity", "Unknown") == None:
 77             fuel_quantity = 0
 78         else:
 79             fuel_quantity = (float(fuel.get("quantity", "Unknown")) * 100)

and replace line 102 (fuel_quantity=(float(fuel.get("quantity", "Unknown")) * 100),) by

102             fuel_quantity=fuel_quantity,
rmpirescosta commented 3 years ago

@maheus IS THIS

    ecomode_id = ecoMode.get("ecoModeEnable", -1)
    ecomode_state = ECO_MAPPING.get(ecomode_id, STATE_UNKNOWN)

    if fuel.get("quantity", "Unknown") == None:
        fuel_quantity = 0
    else:
        fuel_quantity = (float(fuel.get("quantity", "Unknown")) * 100)

    return Info(
        controller_version=controller.get("version", "Unknown"),
        heating_time=int(stats.get("heatingTime", 0)),
        igniter_starts=stats.get("igniterStarts", 0),
        ip=unit.get("ip", "Unknown"),
        misfires=stats.get("misfires", 0),
        overheatings=stats.get("overheatings", 0),
        rssi=rssi,
        signal_strength=signal_strength,
        state_id=state_id,
        state=state,
        status_id=status_id,
        status=status,
        kw=float(power.get("actualPower", 0)),
        actualpower=float(power.get("kw", 0)),
        target_temperature=temperature.get("set", 0),
        temperature=temperature.get("actual", 0),
        unit_id=unit.get("id", "Unknown"),
        unit_version=unit.get("version", "Unknown"),
        uptime=int(stats.get("uptime", 0)),
        fuel_quality=int(fuel.get("quality", "Unknown")),
        fuel_quantity=fuel_quantity,
        ecomode_type=int(ecoMode.get("ecoModeSetType", "Unknown")),
        ecomode_state=ecomode_state,
        timers=timers,
    )
maheus commented 3 years ago

yes

rmpirescosta commented 3 years ago

@maheus BINGO thank you, it was resolved

maheus commented 3 years ago

no problem , i'm going to change the code in git

Lirik-JuKi commented 2 years ago

Hello, i have the same problem, no any entities exist. for curl curl -H 'username:0016D00+++++' -H 'password:++++' https://api.fumis.si/v1/status/ have answer: {"apiVersion":"1.0","unit":{"id":"0016D00

dirkclae commented 1 year ago

Hi, is the server of fumis.si down. I get as response: No server is available to handle this request.