GithubHelp home page GithubHelp logo

Comments (10)

orcema avatar orcema commented on August 25, 2024 1

it works now, thanks.
It's awesom to be able to switch the firewall rules from inside home assistant :-)

from hass-pfsense.

travisghansen avatar travisghansen commented on August 25, 2024

What do you see in the hass logs?

from hass-pfsense.

orcema avatar orcema commented on August 25, 2024

2021-10-22 20:40:37 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140020065658912] 'tracker'
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 185, in handle_call_service
await hass.services.async_call(
File "/usr/src/homeassistant/homeassistant/core.py", line 1491, in async_call
task.result()
File "/usr/src/homeassistant/homeassistant/core.py", line 1526, in _execute_service
await handler.job.target(service_call)
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 213, in handle_service
await self.hass.helpers.service.entity_service_call(
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 658, in entity_service_call
future.result() # pop exception if have
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 830, in async_request_call
await coro
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 695, in _handle_entity_call
await result
File "/config/custom_components/pfsense/switch.py", line 248, in async_turn_off
await self.hass.async_add_executor_job(client.disable_filter_rule_by_tracker, tracker)
File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/pfsense/pypfsense/init.py", line 153, in disable_filter_rule_by_tracker
if rule["tracker"] != tracker:
KeyError: 'tracker'

from hass-pfsense.

travisghansen avatar travisghansen commented on August 25, 2024

I'm a bit confused here, the screenshot seems to indicate the filter became unavailable (was it delete from pfsense?) which means it's odd you could try to toggle at all...I'll make the code more robust for turning on/off rules and we'll see what happens.

from hass-pfsense.

travisghansen avatar travisghansen commented on August 25, 2024

OK, pull the latest code and see what you get..

from hass-pfsense.

orcema avatar orcema commented on August 25, 2024

i pulled the latest code, deleted the integration and installed again the integration but i still get the error

2021-10-22 21:40:23 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140183731327376] 'tracker'
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 185, in handle_call_service
await hass.services.async_call(
File "/usr/src/homeassistant/homeassistant/core.py", line 1491, in async_call
task.result()
File "/usr/src/homeassistant/homeassistant/core.py", line 1526, in _execute_service
await handler.job.target(service_call)
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 213, in handle_service
await self.hass.helpers.service.entity_service_call(
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 658, in entity_service_call
future.result() # pop exception if have
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 830, in async_request_call
await coro
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 695, in _handle_entity_call
await result
File "/config/custom_components/pfsense/switch.py", line 249, in async_turn_off
await self.coordinator.async_refresh()
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 165, in async_refresh
await self._async_refresh(log_failures=True)
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 265, in _async_refresh
update_callback()
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 325, in _handle_coordinator_update
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 456, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 489, in _async_write_ha_state
state = self._stringify_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 462, in _stringify_state
if (state := self.state) is None:
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 869, in state
return STATE_ON if self.is_on else STATE_OFF
File "/config/custom_components/pfsense/switch.py", line 223, in is_on
rule = self._pfsense_get_rule()
File "/config/custom_components/pfsense/switch.py", line 216, in _pfsense_get_rule
if rule["tracker"] == tracker:
KeyError: 'tracker'

from hass-pfsense.

travisghansen avatar travisghansen commented on August 25, 2024

What version of pfSense are you running? Do any of the rules not have a Tracking ID value as show toward the bottom of the rule edit screen?

from hass-pfsense.

travisghansen avatar travisghansen commented on August 25, 2024

I've pushed another update to fix the most recent error, try again.

from hass-pfsense.

orcema avatar orcema commented on August 25, 2024

My PFSense version

Screenshot 2021-10-22 at 22 22 18

The rules have a tracking id

Screenshot 2021-10-22 at 22 23 40

I will pull agin the latest code

from hass-pfsense.

travisghansen avatar travisghansen commented on August 25, 2024

Super odd, you must have some rule that's missing the Tracking ID. Glad we got to the bottom of it though and made the code more robust!

from hass-pfsense.

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.